Commit 8ef4f166 authored by hjk's avatar hjk

Fixes: coreplugin: remove another cached core instance singleton

pointer
parent f6f1721a
......@@ -120,7 +120,7 @@ MainWindow::MainWindow() :
m_editorManager(0),
m_fileManager(new FileManager(this)),
m_progressManager(new ProgressManagerPrivate()),
m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)),
m_scriptManager(new ScriptManagerPrivate(this)),
m_variableManager(new VariableManager(this)),
m_vcsManager(new VCSManager()),
m_viewManager(0),
......
......@@ -181,10 +181,8 @@ static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
namespace Core {
namespace Internal {
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent, ICore *core) :
ScriptManager(parent),
m_core(core),
m_initialized(false)
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent)
: ScriptManager(parent), m_initialized(false)
{
}
......@@ -250,7 +248,6 @@ void ScriptManagerPrivate::ensureEngineInitialized()
{
if (m_initialized)
return;
QTC_ASSERT(m_core, return);
// register QObjects that occur as properties
SharedTools::registerQObject<QMainWindow>(m_engine);
SharedTools::registerQObject<QStatusBar>(m_engine);
......@@ -274,7 +271,7 @@ void ScriptManagerPrivate::ensureEngineInitialized()
// SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine);
// Make "core" available
m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, m_core));
m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, Core::ICore::instance()));
// CLASSIC: registerInterfaceWithDefaultPrototype<Core::MessageManager, MessageManagerPrototype>(m_engine);
......
......@@ -37,13 +37,9 @@
#include <coreplugin/scriptmanager/scriptmanager.h>
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtScript/QScriptEngine>
namespace Core {
class ICore;
namespace Internal {
class ScriptManagerPrivate : public Core::ScriptManager
......@@ -51,12 +47,11 @@ class ScriptManagerPrivate : public Core::ScriptManager
Q_OBJECT
public:
ScriptManagerPrivate(QObject *parent, ICore *core);
virtual QScriptEngine &scriptEngine();
explicit ScriptManagerPrivate(QObject *parent);
virtual bool runScript(const QString &script, QString *errorMessage, Stack *stack);
virtual bool runScript(const QString &script, QString *errorMessage);
QScriptEngine &scriptEngine();
bool runScript(const QString &script, QString *errorMessage, Stack *stack);
bool runScript(const QString &script, QString *errorMessage);
static QString engineError(QScriptEngine &scriptEngine);
......@@ -64,7 +59,6 @@ private:
void ensureEngineInitialized();
QScriptEngine m_engine;
ICore *m_core;
bool m_initialized;
};
......
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