aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-26 16:59:46 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-03 17:39:24 +0100
commitfd8981d835f298306a39c5d32b1050bf8f9b5653 (patch)
tree36cbd0d0e6fd038fc4adff19b12a22c9e95ab99a /src/qml/qml/qqmlobjectcreator.cpp
parente525b727f29adad1df3a6a81d6bba7c4617f78ba (diff)
[new compiler] Fix tst_qquickloader::deleteComponentCrash by introducing a watcher for self-deletion
Change-Id: I809a4860831847ab61c7ca0ba302057ec165ee24 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp12
1 files changed, 9 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;
}
}