summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-06-22 16:11:56 +0200
committerhjk <hjk@qt.io>2022-06-23 11:59:12 +0000
commit6250cf20a194e2948f2db68064468e451352fccf (patch)
tree2e54351e1debdc1740dfa74660d76c2745d5a375 /src
parentc1e4c4fde824a8ce67e26f4eaaedc21a84fcd172 (diff)
downloadqt-creator-6250cf20a194e2948f2db68064468e451352fccf.tar.gz
McuSupport: Delay creation of SettingsHandler
There should be no significant activity in a plugin before the initialization phase. Change-Id: Iee2bcff4644ac07c3867fa59ce6613e128bd0390 Reviewed-by: Piotr Mućko <piotr.mucko@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/mcusupport/mcusupportplugin.cpp11
-rw-r--r--src/plugins/mcusupport/mcusupportplugin.h1
2 files changed, 4 insertions, 8 deletions
diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp
index 2f02c615f7..d059fb9829 100644
--- a/src/plugins/mcusupport/mcusupportplugin.cpp
+++ b/src/plugins/mcusupport/mcusupportplugin.cpp
@@ -72,15 +72,12 @@ void printMessage(const QString &message, bool important)
class McuSupportPluginPrivate
{
public:
- explicit McuSupportPluginPrivate(const SettingsHandler::Ptr &settingsHandler)
- : m_settingsHandler(settingsHandler)
- {}
McuSupportDeviceFactory deviceFactory;
McuSupportRunConfigurationFactory runConfigurationFactory;
RunWorkerFactory runWorkerFactory{makeFlashAndRunWorker(),
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
{Constants::RUNCONFIGURATION}};
- SettingsHandler::Ptr m_settingsHandler;
+ SettingsHandler::Ptr m_settingsHandler{new SettingsHandler};
McuSupportOptions m_options{m_settingsHandler};
McuSupportOptionsPage optionsPage{m_options, m_settingsHandler};
McuDependenciesKitAspect environmentPathsKitAspect;
@@ -100,7 +97,7 @@ bool McuSupportPlugin::initialize(const QStringList &arguments, QString *errorSt
Q_UNUSED(errorString)
setObjectName("McuSupportPlugin");
- dd = new McuSupportPluginPrivate(m_settingsHandler);
+ dd = new McuSupportPluginPrivate;
dd->m_options.registerQchFiles();
dd->m_options.registerExamples();
@@ -115,8 +112,8 @@ void McuSupportPlugin::extensionsInitialized()
connect(KitManager::instance(), &KitManager::kitsLoaded, [this]() {
McuKitManager::removeOutdatedKits();
- McuKitManager::createAutomaticKits(m_settingsHandler);
- McuKitManager::fixExistingKits(m_settingsHandler);
+ McuKitManager::createAutomaticKits(dd->m_settingsHandler);
+ McuKitManager::fixExistingKits(dd->m_settingsHandler);
askUserAboutMcuSupportKitsSetup();
});
}
diff --git a/src/plugins/mcusupport/mcusupportplugin.h b/src/plugins/mcusupport/mcusupportplugin.h
index 51d6d4929e..18195e6c05 100644
--- a/src/plugins/mcusupport/mcusupportplugin.h
+++ b/src/plugins/mcusupport/mcusupportplugin.h
@@ -50,7 +50,6 @@ public:
private:
QVector<QObject *> createTestObjects() const final;
- SettingsHandler::Ptr m_settingsHandler{new SettingsHandler};
}; // class McuSupportPlugin