aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <[email protected]>2014-02-26 16:59:46 +0100
committerThe Qt Project <[email protected]>2014-03-03 17:39:24 +0100
commitfd8981d835f298306a39c5d32b1050bf8f9b5653 (patch)
tree36cbd0d0e6fd038fc4adff19b12a22c9e95ab99a /src
parente525b727f29adad1df3a6a81d6bba7c4617f78ba (diff)
[new compiler] Fix tst_qquickloader::deleteComponentCrash by introducing a watcher for self-deletion
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp12
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h2
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