diff options
author | Christian Stenger <christian.stenger@qt.io> | 2020-03-05 13:31:31 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2020-03-05 14:32:55 +0000 |
commit | afffbe01aa478e010a68b389fc0cba930c8692e4 (patch) | |
tree | 47dc3b592254911767393f1fe2da88e7a5361f03 /src/plugins/autotest/autotestplugin.cpp | |
parent | 74f04c17d1a3ce2395e1ae5ea29cbbd9ce56f77f (diff) |
AutoTest: Fix leaking of project settings
Make sure project settings will be destructed
correctly.
Change-Id: I633bf744eb2e0835fe89e3a9f3c2f7293c5f5275
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/autotest/autotestplugin.cpp')
-rw-r--r-- | src/plugins/autotest/autotestplugin.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp index df73f237c6b..46e00c8267d 100644 --- a/src/plugins/autotest/autotestplugin.cpp +++ b/src/plugins/autotest/autotestplugin.cpp @@ -149,15 +149,27 @@ AutotestPluginPrivate::AutotestPluginPrivate(AutotestPlugin *parent) m_frameworkManager->activateFrameworksFromSettings(q->settings()); TestTreeModel::instance()->synchronizeTestFrameworks(); - connect(ProjectExplorer::SessionManager::instance(), - &ProjectExplorer::SessionManager::startupProjectChanged, this, [this] { - m_runconfigCache.clear(); + auto sessionManager = ProjectExplorer::SessionManager::instance(); + connect(sessionManager, &ProjectExplorer::SessionManager::startupProjectChanged, + this, [this] { m_runconfigCache.clear(); }); + + connect(sessionManager, &ProjectExplorer::SessionManager::aboutToRemoveProject, + this, [this] (ProjectExplorer::Project *project) { + auto it = s_projectSettings.find(project); + if (it != s_projectSettings.end()) { + delete it.value(); + s_projectSettings.erase(it); + } }); - } AutotestPluginPrivate::~AutotestPluginPrivate() { + if (!s_projectSettings.isEmpty()) { + qDeleteAll(s_projectSettings.values()); + s_projectSettings.clear(); + } + delete m_navigationWidgetFactory; delete m_resultsPane; delete m_testSettingPage; |