aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-02-23 14:55:16 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-23 07:02:04 +0100
commitdc3165178851b9bda71dd238c8a5faca4dfa7a45 (patch)
tree40878590bc6c6299d454fec42a630d334461fd84 /src
parentbbbc44c45d9a6b7381b775413fcfcc1a72c14317 (diff)
Remove warning produced by 'parent' reference.
When Qt.createQmlObject is invoked from QML, any contained references to parent produce a warning from V8. To prevent this, move the assignment of the parent object to before the initial execution of the bindings. Task-number: QTBUG-24464 Change-Id: Ib330822f1ca46ec5a6af648a56197da09669c3f2 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp
index 12f06e6b76..d338508d09 100644
--- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp
+++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.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) {
QDeclarativeData::get(obj, true)->setImplicitDestructible();
+
+ obj->setParent(parentArg);
+
+ QList<QDeclarativePrivate::AutoParentFunction> functions = QDeclarativeMetaType::parentFunctions();
+ for (int ii = 0; ii < functions.count(); ++ii) {
+ if (QDeclarativePrivate::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<QDeclarativePrivate::AutoParentFunction> functions = QDeclarativeMetaType::parentFunctions();
- for (int ii = 0; ii < functions.count(); ++ii) {
- if (QDeclarativePrivate::Parented == functions.at(ii)(obj, parentArg))
- break;
- }
-
return v8engine->newQObject(obj);
}