summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-06-06 12:45:35 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-06-06 13:00:26 +0200
commit2d9cea2d3b1a7df5c651c37f31688605f7b40ef7 (patch)
tree12a99aebb89e6cb73e1724090e61d2e408a897e8 /src
parent651a30e627dca79ee858751be057f152ff6263d7 (diff)
Set the right ownership for the components we expose.
Make sure we set the component ownership to c++, by default the script engine would take it and delete the component... Change-Id: If4ea905495566954ff804b636934c33eb118ccf3 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/scriptengine.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp
index 252c3480b..0c7b3a77c 100644
--- a/src/libs/installer/scriptengine.cpp
+++ b/src/libs/installer/scriptengine.cpp
@@ -79,8 +79,11 @@ ScriptEngine::ScriptEngine(PackageManagerCore *core)
const QList<Component*> components = core->availableComponents();
QJSValue scriptComponentsObject = m_engine.newArray(components.count());
- for (int i = 0; i < components.count(); ++i)
- scriptComponentsObject.setProperty(i, newQObject(components[i]));
+ for (int i = 0; i < components.count(); ++i) {
+ Component *const component = components.at(i);
+ QQmlEngine::setObjectOwnership(component, QQmlEngine::CppOwnership);
+ scriptComponentsObject.setProperty(i, newQObject(component));
+ }
global.property(QLatin1String("installer")).setProperty(QLatin1String("components"),
scriptComponentsObject);
} else {