forked from qt-creator/qt-creator
ExtensionSystem: Remove the IPlugin back pointer to pluginspec
The price of having to loop in two places seems small compared to cleaner relations between the classes. There's a new hack in the helpmanager to make sure we aren't looping to often. The hack wouldn't be needed if the (odd(?)) check there weren't there. Change-Id: Ifed50213b2de8feedfb45c185808d163c00c19ca Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
|
||||
#include "coreplugin.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <extensionsystem/pluginspec.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -22,12 +24,17 @@ static Implementation *m_instance = nullptr;
|
||||
|
||||
static bool checkInstance()
|
||||
{
|
||||
auto plugin = Internal::CorePlugin::instance();
|
||||
// HelpManager API can only be used after the actual implementation has been created by the
|
||||
// Help plugin, so check that the plugins have all been created. That is the case
|
||||
// when the Core plugin is initialized.
|
||||
QTC_CHECK(plugin && plugin->pluginSpec()
|
||||
&& plugin->pluginSpec()->state() >= ExtensionSystem::PluginSpec::Initialized);
|
||||
static bool afterPluginCreation = false;
|
||||
if (!afterPluginCreation) {
|
||||
using namespace ExtensionSystem;
|
||||
auto plugin = Internal::CorePlugin::instance();
|
||||
// HelpManager API can only be used after the actual implementation has been created by the
|
||||
// Help plugin, so check that the plugins have all been created. That is the case
|
||||
// when the Core plugin is initialized.
|
||||
PluginSpec *pluginSpec = PluginManager::specForPlugin(plugin);
|
||||
afterPluginCreation = (plugin && pluginSpec && pluginSpec->state() >= PluginSpec::Initialized);
|
||||
QTC_CHECK(afterPluginCreation);
|
||||
}
|
||||
return m_instance != nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user