diff options
author | Simon Hausmann <[email protected]> | 2014-02-26 16:59:46 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-03-03 17:39:24 +0100 |
commit | fd8981d835f298306a39c5d32b1050bf8f9b5653 (patch) | |
tree | 36cbd0d0e6fd038fc4adff19b12a22c9e95ab99a /src | |
parent | e525b727f29adad1df3a6a81d6bba7c4617f78ba (diff) |
[new compiler] Fix tst_qquickloader::deleteComponentCrash by introducing a watcher for self-deletion
Change-Id: I809a4860831847ab61c7ca0ba302057ec165ee24
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 12 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index ff75e587ef..8d59c79e59 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -131,6 +131,9 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext) QQmlObjectCreator::~QQmlObjectCreator() { if (sharedState.flag()) { + { + QRecursionWatcher<QQmlObjectCreatorSharedState, &QQmlObjectCreatorSharedState::recursionNode> watcher(sharedState.data()); + } for (int i = 0; i < sharedState->allCreatedBindings.count(); ++i) { QQmlAbstractBinding *b = sharedState->allCreatedBindings.at(i); if (b) @@ -1077,6 +1080,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent) QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interrupt) { + QRecursionWatcher<QQmlObjectCreatorSharedState, &QQmlObjectCreatorSharedState::recursionNode> watcher(sharedState.data()); ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine)); { @@ -1084,7 +1088,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru trace.event("begin binding eval"); while (!sharedState->allCreatedBindings.isEmpty()) { - if (interrupt.shouldInterrupt()) + if (watcher.hasRecursed() || interrupt.shouldInterrupt()) return 0; QQmlAbstractBinding *b = sharedState->allCreatedBindings.pop(); @@ -1109,7 +1113,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru status->componentComplete(); } - if (interrupt.shouldInterrupt()) + if (watcher.hasRecursed() || interrupt.shouldInterrupt()) return 0; } } @@ -1123,6 +1127,8 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru void *args[] = { 0 }; QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, callback.second, args); } + if (watcher.hasRecursed()) + return 0; } sharedState->finalizeCallbacks.clear(); } @@ -1139,7 +1145,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru // ### designer if (componentCompleteEnabled()) emit a->completed(); - if (interrupt.shouldInterrupt()) + if (watcher.hasRecursed() || interrupt.shouldInterrupt()) return 0; } } diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index 5b7ee039c4..58cb55e633 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -47,6 +47,7 @@ #include <private/qqmlcompiler_p.h> #include <private/qqmltypecompiler_p.h> #include <private/qfinitestack_p.h> +#include <private/qrecursionwatcher_p.h> QT_BEGIN_NAMESPACE @@ -62,6 +63,7 @@ struct QQmlObjectCreatorSharedState QFiniteStack<QQmlParserStatus*> allParserStatusCallbacks; QQmlComponentAttached *componentAttached; QList<QQmlEnginePrivate::FinalizeCallback> finalizeCallbacks; + QRecursionNode recursionNode; }; class QQmlObjectCreator |