diff options
Diffstat (limited to 'src/qml/qml/v8/qqmlbuiltinfunctions.cpp')
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 5284832ae1..7d7aaa2148 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1096,8 +1096,17 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args) V8THROW_ERROR("Qt.createQmlObject(): Component is not ready"); QObject *obj = component.beginCreate(effectiveContext); - if (obj) + if (obj) { QQmlData::get(obj, true)->setImplicitDestructible(); + + obj->setParent(parentArg); + + QList<QQmlPrivate::AutoParentFunction> functions = QQmlMetaType::parentFunctions(); + for (int ii = 0; ii < functions.count(); ++ii) { + if (QQmlPrivate::Parented == functions.at(ii)(obj, parentArg)) + break; + } + } component.completeCreate(); if (component.isError()) { @@ -1107,14 +1116,6 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args) Q_ASSERT(obj); - obj->setParent(parentArg); - - QList<QQmlPrivate::AutoParentFunction> functions = QQmlMetaType::parentFunctions(); - for (int ii = 0; ii < functions.count(); ++ii) { - if (QQmlPrivate::Parented == functions.at(ii)(obj, parentArg)) - break; - } - return v8engine->newQObject(obj); } |