diff options
author | Tobias Hunger <tobias.hunger@digia.com> | 2013-02-25 14:12:14 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@digia.com> | 2013-02-26 15:26:06 +0100 |
commit | e992ea1b908c21ffbbe78e40c2d3dae1d43a89bf (patch) | |
tree | 3cbbf251ef7c14ed108cecac49b323ded2d9cea3 /src/plugins/projectexplorer/kitmanager.cpp | |
parent | 5f68b5b02fb38ea75812514d2531aa2123937efc (diff) | |
download | qt-creator-e992ea1b908c21ffbbe78e40c2d3dae1d43a89bf.tar.gz |
Kits: Warn when initializing something too early/late
Warn when somebody tries to register KitInformation after kits are
already loaded. Also warn when trying to access kits before all
plugins are initialized.
This helps with making sure that initialization of plugins is done as
expected.
Change-Id: Ie2e9c79eee2a2c0de3397db9a95b5e41b614bfe8
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/projectexplorer/kitmanager.cpp')
-rw-r--r-- | src/plugins/projectexplorer/kitmanager.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index cab0927994..7166b5ff0b 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -34,10 +34,12 @@ #include "kitinformation.h" #include "kitmanagerconfigwidget.h" #include "project.h" +#include "projectexplorer.h" #include <coreplugin/icore.h> #include <extensionsystem/pluginmanager.h> +#include <extensionsystem/pluginspec.h> #include <utils/persistentsettings.h> #include <utils/environment.h> @@ -137,6 +139,7 @@ void KitManager::restoreKits() return; initializing = true; + QTC_CHECK(ProjectExplorerPlugin::instance()->pluginSpec()->state() == ExtensionSystem::PluginSpec::Running); QList<Kit *> kitsToRegister; QList<Kit *> kitsToValidate; @@ -261,6 +264,9 @@ bool greaterPriority(KitInformation *a, KitInformation *b) void KitManager::registerKitInformation(KitInformation *ki) { + QTC_CHECK(ProjectExplorerPlugin::instance()->pluginSpec()->state() <= ExtensionSystem::PluginSpec::Initialized); + QTC_CHECK(d->m_kitList.isEmpty()); + QList<KitInformation *>::iterator it = qLowerBound(d->m_informationList.begin(), d->m_informationList.end(), ki, greaterPriority); d->m_informationList.insert(it, ki); @@ -456,7 +462,7 @@ void KitManager::setDefaultKit(Kit *k) void KitManager::validateKits() { - foreach (Kit *k, kits()) + foreach (Kit *k, d->m_kitList) // no need to load kits just to validate them! k->validate(); } |