Commit a5828911 authored by Tobias Hunger's avatar Tobias Hunger

JsExpander: Do not crash on exit

Change-Id: I55caca6dd5b316b2573b443175448d732101871c
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 2b89e759
......@@ -56,6 +56,7 @@ static Internal::JsExpanderPrivate *d;
void JsExpander::registerQObjectForJs(const QString &name, QObject *obj)
{
obj->setParent(0); // take ownership!
d->m_registeredObjects.append(obj);
QScriptValue jsObj = d->m_engine.newQObject(obj, QScriptEngine::QtOwnership);
d->m_engine.globalObject().setProperty(name, jsObj);
......
......@@ -45,7 +45,7 @@ class CppToolsJsExtension : public QObject
Q_OBJECT
public:
CppToolsJsExtension(QObject *parent) : QObject(parent) { }
CppToolsJsExtension(QObject *parent = 0) : QObject(parent) { }
// Generate header guard:
Q_INVOKABLE QString headerGuard(const QString &in) const;
......
......@@ -146,7 +146,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
modelManager->updateSourceFiles(files.toSet());
});
JsExpander::registerQObjectForJs(QLatin1String("Cpp"), new CppToolsJsExtension(this));
JsExpander::registerQObjectForJs(QLatin1String("Cpp"), new CppToolsJsExtension);
CppLocatorData *locatorData = new CppLocatorData;
connect(modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)),
......
......@@ -72,7 +72,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
if (!MimeDatabase::addMimeTypes(QLatin1String(":qtsupport/QtSupport.mimetypes.xml"), errorMessage))
return false;
JsExpander::registerQObjectForJs(QLatin1String("QtSupport"), new CodeGenerator(this));
JsExpander::registerQObjectForJs(QLatin1String("QtSupport"), new CodeGenerator);
addAutoReleasedObject(new QtVersionManager);
addAutoReleasedObject(new DesktopQtVersionFactory);
......
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