aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-10 09:06:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-16 22:08:32 +0100
commit6539a4c99d042a72db78b30e47e6cc1acd35f856 (patch)
tree1d939be9bec18c850cc1938ce53ae2566760ea1a /src/qml/qml/qqmlobjectcreator.cpp
parent037ac0f08e9365ecf58af52749f262de50d97752 (diff)
[new compiler] Fix test with aggressive gc
We need a scope object protector right after creating the JS wrapper, which is right after creating the VME meta object. Change-Id: I76668027486a44bab35a3193b4c1c6fbab5c3e0e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index d7ce968508..eb6076bff1 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1133,6 +1133,10 @@ bool QmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPoi
qSwap(_ddata, declarativeData);
qSwap(_bindingTarget, bindingTarget);
+ QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
+ QV4::Scope valueScope(v4);
+ QV4::ScopedValue scopeObjectProtector(valueScope);
+
QQmlVMEMetaObject *vmeMetaObject = 0;
const QByteArray data = vmeMetaObjectData.value(index);
if (!data.isEmpty()) {
@@ -1140,6 +1144,7 @@ bool QmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPoi
vmeMetaObject = new QQmlVMEMetaObject(_qobject, _propertyCache, reinterpret_cast<const QQmlVMEMetaData*>(data.constData()));
if (_ddata->propertyCache)
_ddata->propertyCache->release();
+ scopeObjectProtector = _ddata->jsWrapper.value();
} else {
vmeMetaObject = QQmlVMEMetaObject::get(_qobject);
}