Commit e992ea1b authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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

Change-Id: Ie2e9c79eee2a2c0de3397db9a95b5e41b614bfe8
Reviewed-by: default avatarDaniel Teske <>
parent 5f68b5b0
......@@ -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()
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);
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!
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment