diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-01-28 14:34:43 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-01-28 15:11:08 +0000 |
commit | f36555f077d215dbef0ebd36b8f7a5877528d1cc (patch) | |
tree | 5a586a4d19929565cf038d8994c74f08f62ac256 /src/libs/installer/scriptengine_p.h | |
parent | d7ce2ba4a78e4c056f06bd89da43f50458462ad0 (diff) |
Make sure component wrapper is not deleted in advance
Use ScriptEngine::newQObject instead of the stock QScriptEngine one.
This one (among other things) sets object ownership to Cpp, preventing
dubious "cannot call name on undefined" script failures if the garbage
collector runs.
Change-Id: Ib3275012d307533c13de3520f4630d1eeee66869
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/scriptengine_p.h')
-rw-r--r-- | src/libs/installer/scriptengine_p.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libs/installer/scriptengine_p.h b/src/libs/installer/scriptengine_p.h index 696073703..eeb547a78 100644 --- a/src/libs/installer/scriptengine_p.h +++ b/src/libs/installer/scriptengine_p.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Installer Framework. @@ -42,7 +42,6 @@ #include <QDebug> #include <QDesktopServices> #include <QFileDialog> -#include <QJSEngine> #include <QStandardPaths> namespace QInstaller { @@ -65,18 +64,14 @@ class InstallerProxy : public QObject Q_DISABLE_COPY(InstallerProxy) public: - InstallerProxy(QJSEngine *engine, PackageManagerCore *core) + InstallerProxy(ScriptEngine *engine, PackageManagerCore *core) : m_engine(engine), m_core(core) {} -public slots : - QJSValue componentByName(const QString &componentName) { - if (m_core) - return m_engine->newQObject(m_core->componentByName(componentName)); - return QJSValue(); - } +public slots: + QJSValue componentByName(const QString &componentName); private: - QJSEngine *m_engine; + ScriptEngine *m_engine; PackageManagerCore *m_core; }; |