diff --git a/src/plugins/projectexplorer/projectimporter.cpp b/src/plugins/projectexplorer/projectimporter.cpp index 5fc989b193e..4aaa404065c 100644 --- a/src/plugins/projectexplorer/projectimporter.cpp +++ b/src/plugins/projectexplorer/projectimporter.cpp @@ -131,7 +131,9 @@ QList ProjectImporter::import(const Utils::FileName &importPath, bo } } - qDeleteAll(dataList); + foreach (auto *dd, dataList) + deleteDirectoryData(dd); + dataList.clear(); if (result.isEmpty() && !silent) QMessageBox::critical(Core::ICore::mainWindow(), diff --git a/src/plugins/projectexplorer/projectimporter.h b/src/plugins/projectexplorer/projectimporter.h index e6406787f20..c44829e713e 100644 --- a/src/plugins/projectexplorer/projectimporter.h +++ b/src/plugins/projectexplorer/projectimporter.h @@ -86,6 +86,8 @@ protected: // will get one of the results from examineDirectory virtual QList buildInfoListForKit(const Kit *k, void *directoryData) const = 0; + virtual void deleteDirectoryData(void *directoryData) const = 0; + using KitSetupFunction = std::function; ProjectExplorer::Kit *createTemporaryKit(const KitSetupFunction &setup) const; diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp index 3310f25ce78..a3508b81dce 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp @@ -265,6 +265,11 @@ QList QmakeProjectImporter::buildInfoListForKit(const Kit *k, void return result; } +void QmakeProjectImporter::deleteDirectoryData(void *directoryData) const +{ + delete static_cast(directoryData); +} + static ToolChain *preferredToolChain(BaseQtVersion *qtVersion, const FileName &ms, const QMakeStepConfig::TargetArchConfig &archConfig) { diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h index 4859ca0ee99..5d1aec6c8ed 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.h @@ -52,6 +52,7 @@ private: QList buildInfoListForKit(const ProjectExplorer::Kit *k, void *directoryData) const final; + void deleteDirectoryData(void *directoryData) const final; ProjectExplorer::Kit *createTemporaryKit(const QtProjectImporter::QtVersionData &data, const Utils::FileName &parsedSpec,