forked from qt-creator/qt-creator
QmlJsInspector: Fix crash on plugin initialization
Delay the setup of the UI until the Debug mode is activated. This is required by the Debugger now setting up most of it's UI in extensionsInitialized ...
This commit is contained in:
@@ -45,6 +45,9 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QtPlugin>
|
||||
@@ -114,7 +117,9 @@ void InspectorPlugin::extensionsInitialized()
|
||||
connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(objectAdded(QObject*)));
|
||||
connect(pluginManager, SIGNAL(aboutToRemoveObject(QObject*)), SLOT(aboutToRemoveObject(QObject*)));
|
||||
|
||||
m_inspectorUi->setupUi();
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
connect(core->modeManager(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
|
||||
this, SLOT(modeAboutToChange(Core::IMode*)));
|
||||
}
|
||||
|
||||
void InspectorPlugin::objectAdded(QObject *object)
|
||||
@@ -155,4 +160,18 @@ void InspectorPlugin::clientProxyConnected()
|
||||
m_inspectorUi->connected(m_clientProxy);
|
||||
}
|
||||
|
||||
void InspectorPlugin::modeAboutToChange(Core::IMode *newMode)
|
||||
{
|
||||
QTC_ASSERT(newMode, return);
|
||||
|
||||
if (newMode->id() == Debugger::Constants::MODE_DEBUG) {
|
||||
m_inspectorUi->setupUi();
|
||||
|
||||
// make sure we're not called again
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
disconnect(core->modeManager(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
|
||||
this, SLOT(modeAboutToChange(Core::IMode*)));
|
||||
}
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(InspectorPlugin)
|
||||
|
||||
@@ -75,6 +75,7 @@ private slots:
|
||||
void objectAdded(QObject *object);
|
||||
void aboutToRemoveObject(QObject *obj);
|
||||
void clientProxyConnected();
|
||||
void modeAboutToChange(Core::IMode *mode);
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
|
||||
Reference in New Issue
Block a user