diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-25 07:24:03 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-25 07:24:03 (GMT) |
commit | 57e6192785db1617e233fc4a321da82e5e06ec81 (patch) | |
tree | cc1241c139f26c77566d24184414bef38a60c851 /src/declarative/qml/qdeclarativecontext.cpp | |
parent | c86fc55faa28551f06ca569d3fcc26b101efc90c (diff) | |
download | Qt-57e6192785db1617e233fc4a321da82e5e06ec81.zip Qt-57e6192785db1617e233fc4a321da82e5e06ec81.tar.gz Qt-57e6192785db1617e233fc4a321da82e5e06ec81.tar.bz2 |
Don't circumvent onDestruction handlers when clearing expression in delegate cleanup
We clear all expressions when removing a delegate in order to avoid
spurious warnings. This also removed onDestruction handlers. Ensure
the onDestruction handlers are called before the expressions are cleared.
Task-number: QTBUG-12946
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/declarative/qml/qdeclarativecontext.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativecontext.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index a58dc6c..a3b16d9 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -533,8 +533,21 @@ void QDeclarativeContextData::invalidate() parent = 0; } -void QDeclarativeContextData::clearExpressions() +void QDeclarativeContextData::clearContext() { + if (engine) { + while (componentAttached) { + QDeclarativeComponentAttached *a = componentAttached; + componentAttached = a->next; + if (componentAttached) componentAttached->prev = &componentAttached; + + a->next = 0; + a->prev = 0; + + emit a->destruction(); + } + } + QDeclarativeAbstractExpression *expression = expressions; while (expression) { QDeclarativeAbstractExpression *nextExpression = expression->m_nextExpression; @@ -555,7 +568,7 @@ void QDeclarativeContextData::destroy() if (engine) invalidate(); - clearExpressions(); + clearContext(); while (contextObjects) { QDeclarativeData *co = contextObjects; |