diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-06 21:15:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 12:44:14 +0100 |
commit | 89c8e1e4a398c68daceb820950855cde5297e23a (patch) | |
tree | b13e0a4898bed2b2e1359ba7b2ba7c9109c89da1 /src/qml | |
parent | 1583093081d6d74acd7618880c7d6101961f47ad (diff) |
[new compiler] Fix component attachment linking across sub object creators
This brings up the list view in the components gallery.
Change-Id: Ib91ca3b30b8093acad0343b47be60cf4b51e4da7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index cc7ea57602..6abf805a4a 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -992,7 +992,7 @@ QQmlComponentAttached *QQmlComponent::qmlAttachedProperties(QObject *obj) if (p->activeVME) { // XXX should only be allowed during begin a->add(&p->activeVME->componentAttached); } else if (p->activeObjectCreator) { - a->add(&p->activeObjectCreator->componentAttached); + a->add(p->activeObjectCreator->componentAttached); } else { QQmlData *d = QQmlData::get(obj); Q_ASSERT(d); diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index faeb3753ea..e2063a979f 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -110,6 +110,9 @@ QmlObjectCreator::QmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledD if (!compiledData->isInitialized()) compiledData->initialize(engine); + componentAttachedImpl = 0; + componentAttached = &componentAttachedImpl; + if (inheritedBindingStack) { Q_ASSERT(rootContext); Q_ASSERT(inheritedParserStatusStack); @@ -974,13 +977,12 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent) return 0; } QmlObjectCreator subCreator(context, typeRef->component, creationContext, rootContext, allCreatedBindings, allParserStatusCallbacks); + subCreator.componentAttached = componentAttached; instance = subCreator.create(); if (!instance) { errors += subCreator.errors; return 0; } - if (subCreator.componentAttached) - subCreator.componentAttached->add(&componentAttached); } // ### use no-event variant if (parent) @@ -1100,8 +1102,8 @@ QQmlContextData *QmlObjectCreator::finalize(QQmlInstantiationInterrupt &interrup { QQmlTrace trace("VME Component.onCompleted Callbacks"); - while (componentAttached) { - QQmlComponentAttached *a = componentAttached; + while (componentAttachedImpl) { + QQmlComponentAttached *a = componentAttachedImpl; a->rem(); QQmlData *d = QQmlData::get(a->parent()); Q_ASSERT(d); diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index 251628d5f8..68f2eaeab3 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -65,7 +65,7 @@ public: QObject *create(int subComponentIndex = -1, QObject *parent = 0); QQmlContextData *finalize(QQmlInstantiationInterrupt &interrupt); - QQmlComponentAttached *componentAttached; + QQmlComponentAttached **componentAttached; QList<QQmlEnginePrivate::FinalizeCallback> finalizeCallbacks; QList<QQmlError> errors; @@ -101,6 +101,7 @@ private: bool ownBindingAndParserStatusStacks; QQmlCompiledData *compiledData; QQmlContextData *rootContext; + QQmlComponentAttached *componentAttachedImpl; QObject *_qobject; QObject *_scopeObject; |