Commit 5cd1cd10 authored by Kai Koehne's avatar Kai Koehne
Browse files

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 ...
parent f179c936
......@@ -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();
......
Markdown is supported
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