McuSupport: Auto manage memory of McuPackage's version detector

Use smart pointer for member of McuPackage.

Change-Id: I2474fc791b91c489be77aee3aab86401aaef76e8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Piotr Mućko
2022-06-02 16:13:08 +02:00
parent 8b6aeb9d16
commit 1c4abbf069
4 changed files with 8 additions and 8 deletions

View File

@@ -26,6 +26,7 @@
#pragma once
#include "mcuabstractpackage.h"
#include "mcusupportversiondetection.h"
#include "settingshandler.h"
#include <utils/filepath.h>
@@ -102,7 +103,7 @@ private:
const Utils::FilePath m_defaultPath;
const Utils::FilePath m_detectionPath;
const QString m_settingsKey;
const McuPackageVersionDetector *m_versionDetector;
QScopedPointer<const McuPackageVersionDetector> m_versionDetector;
Utils::FilePath m_path;
Utils::FilePath m_relativePathModifier; // relative path to m_path to be returned by path()

View File

@@ -26,14 +26,12 @@
#pragma once
#include <utils/filepath.h>
#include <QObject>
#include <QString>
namespace McuSupport {
namespace Internal {
namespace McuSupport::Internal {
class McuPackageVersionDetector : public QObject
class McuPackageVersionDetector
{
Q_OBJECT
public:
McuPackageVersionDetector();
virtual ~McuPackageVersionDetector() = default;
@@ -98,5 +96,4 @@ private:
const QString m_versionRegExp;
};
} // namespace Internal
} // namespace McuSupport
} // namespace McuSupport::Internal

View File

@@ -27,6 +27,7 @@
#include "mcuhelpers.h"
#include "mcupackage.h"
#include "mcusupportconstants.h"
#include "mcusupportversiondetection.h"
#include "mcutarget.h"
#include "mcutargetdescription.h"

View File

@@ -40,6 +40,7 @@
#include "mcusupportconstants.h"
#include "mcusupportoptions.h"
#include "mcusupportsdk.h"
#include "mcusupportversiondetection.h"
#include "mcutargetdescription.h"
#include "mcutargetfactorylegacy.h"