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>
This commit is contained in:
hjk
2022-06-22 16:11:56 +02:00
parent c1e4c4fde8
commit 6250cf20a1
2 changed files with 4 additions and 8 deletions

View File

@@ -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();
});
}

View File

@@ -50,7 +50,6 @@ public:
private:
QVector<QObject *> createTestObjects() const final;
SettingsHandler::Ptr m_settingsHandler{new SettingsHandler};
}; // class McuSupportPlugin