aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-02 09:58:13 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-02 10:32:33 +0200
commit41e924eb6e1c690bc81d095fc5e8f57244aae964 (patch)
treeb459dfa150530443901be68471df88c69ca7a7d4 /src/qml/qml/qqmlobjectcreator.cpp
parentd51afdb74fdcb9a5c7e1fdaa763325c78d794d06 (diff)
parent87a5889029aed8c53a4b02a42804d036614db36b (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: .qmake.conf examples/quick/scenegraph/openglunderqml/squircle.h src/quick/doc/src/qmltypereference.qdoc src/quick/scenegraph/qsgthreadedrenderloop.cpp Change-Id: Ife4f4b897044a7ffcd0710493c6aed1d87cf1ef9
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 5eaea7d9f4..8fae12326f 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -91,7 +91,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompile
init(parentContext);
sharedState = new QQmlObjectCreatorSharedState;
- sharedState.setFlag(); // We own it, so we must delete it
+ topLevelCreator = true;
sharedState->componentAttached = 0;
sharedState->allCreatedBindings.allocate(compiledData->totalBindingsCount);
sharedState->allParserStatusCallbacks.allocate(compiledData->totalParserStatusCount);
@@ -115,6 +115,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompile
init(parentContext);
sharedState = inheritedSharedState;
+ topLevelCreator = false;
}
void QQmlObjectCreator::init(QQmlContextData *providedParentContext)
@@ -139,9 +140,9 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext)
QQmlObjectCreator::~QQmlObjectCreator()
{
- if (sharedState.flag()) {
+ if (topLevelCreator) {
{
- QRecursionWatcher<QQmlObjectCreatorSharedState, &QQmlObjectCreatorSharedState::recursionNode> watcher(sharedState.data());
+ QQmlObjectCreatorRecursionWatcher watcher(this);
}
for (int i = 0; i < sharedState->allCreatedBindings.count(); ++i) {
QQmlAbstractBinding *b = sharedState->allCreatedBindings.at(i);
@@ -153,7 +154,10 @@ QQmlObjectCreator::~QQmlObjectCreator()
if (ps)
ps->d = 0;
}
- delete sharedState.data();
+ while (sharedState->componentAttached) {
+ QQmlComponentAttached *a = sharedState->componentAttached;
+ a->rem();
+ }
}
}
@@ -1177,7 +1181,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
Q_ASSERT(phase == ObjectsCreated || phase == Finalizing);
phase = Finalizing;
- QRecursionWatcher<QQmlObjectCreatorSharedState, &QQmlObjectCreatorSharedState::recursionNode> watcher(sharedState.data());
+ QQmlObjectCreatorRecursionWatcher watcher(this);
ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine));
{
@@ -1262,6 +1266,11 @@ void QQmlObjectCreator::clear()
while (!sharedState->allCreatedObjects.isEmpty())
delete sharedState->allCreatedObjects.pop();
+ while (sharedState->componentAttached) {
+ QQmlComponentAttached *a = sharedState->componentAttached;
+ a->rem();
+ }
+
phase = Done;
}
@@ -1334,3 +1343,10 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
}
+
+
+QQmlObjectCreatorRecursionWatcher::QQmlObjectCreatorRecursionWatcher(QQmlObjectCreator *creator)
+ : sharedState(creator->sharedState)
+ , watcher(creator->sharedState.data())
+{
+}