From fd8981d835f298306a39c5d32b1050bf8f9b5653 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 26 Feb 2014 16:59:46 +0100 Subject: [new compiler] Fix tst_qquickloader::deleteComponentCrash by introducing a watcher for self-deletion Change-Id: I809a4860831847ab61c7ca0ba302057ec165ee24 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlobjectcreator.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/qml/qml/qqmlobjectcreator.cpp') 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 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 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; } } -- cgit v1.2.3