diff options
Diffstat (limited to 'src/declarative/qml/qdeclarativecomponent.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativecomponent.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 7744b75..5cc6639 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -657,11 +657,11 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *ctxt, QDe state->bindValues = enginePriv->bindValues; state->parserStatus = enginePriv->parserStatus; - state->componentAttacheds = enginePriv->componentAttacheds; - if (state->componentAttacheds) - state->componentAttacheds->prev = &state->componentAttacheds; + state->componentAttached = enginePriv->componentAttached; + if (state->componentAttached) + state->componentAttached->prev = &state->componentAttached; - enginePriv->componentAttacheds = 0; + enginePriv->componentAttached = 0; enginePriv->bindValues.clear(); enginePriv->parserStatus.clear(); state->completePending = true; @@ -688,11 +688,11 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi state->bindValues = enginePriv->bindValues; state->parserStatus = enginePriv->parserStatus; - state->componentAttacheds = enginePriv->componentAttacheds; - if (state->componentAttacheds) - state->componentAttacheds->prev = &state->componentAttacheds; + state->componentAttached = enginePriv->componentAttached; + if (state->componentAttached) + state->componentAttached->prev = &state->componentAttached; - enginePriv->componentAttacheds = 0; + enginePriv->componentAttached = 0; enginePriv->bindValues.clear(); enginePriv->parserStatus.clear(); state->completePending = true; @@ -729,11 +729,13 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri QDeclarativeEnginePrivate::clear(ps); } - while (state->componentAttacheds) { - QDeclarativeComponentAttached *a = state->componentAttacheds; - if (a->next) a->next->prev = &state->componentAttacheds; - state->componentAttacheds = a->next; - a->prev = 0; a->next = 0; + while (state->componentAttached) { + QDeclarativeComponentAttached *a = state->componentAttached; + a->rem(); + QDeclarativeData *d = QDeclarativeData::get(a->parent()); + Q_ASSERT(d); + Q_ASSERT(d->context); + a->add(&d->context->componentAttached); emit a->completed(); } @@ -793,15 +795,18 @@ QDeclarativeComponentAttached *QDeclarativeComponent::qmlAttachedProperties(QObj QDeclarativeComponentAttached *a = new QDeclarativeComponentAttached(obj); QDeclarativeEngine *engine = qmlEngine(obj); - if (!engine || !QDeclarativeEnginePrivate::get(engine)->inBeginCreate) + if (!engine) return a; - QDeclarativeEnginePrivate *p = QDeclarativeEnginePrivate::get(engine); - - a->next = p->componentAttacheds; - a->prev = &p->componentAttacheds; - if (a->next) a->next->prev = &a->next; - p->componentAttacheds = a; + if (QDeclarativeEnginePrivate::get(engine)->inBeginCreate) { + QDeclarativeEnginePrivate *p = QDeclarativeEnginePrivate::get(engine); + a->add(&p->componentAttached); + } else { + QDeclarativeData *d = QDeclarativeData::get(obj); + Q_ASSERT(d); + Q_ASSERT(d->context); + a->add(&d->context->componentAttached); + } return a; } |