aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-07-08 09:47:20 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-07-10 13:57:05 +0200
commit9a9c526f6876fed7f23c79e4d82f6fe0fbc22041 (patch)
tree83dc290a0319593f777c0a8406d44fb862790f6a /src/qml/qml/qqmlobjectcreator.cpp
parent2d83adbec9252cf156b71fdb2496c974c4478887 (diff)
QQmlObjectCreator: Do not delete objects not owned by engine
Fixes: QTBUG-76932 Change-Id: I05c8dba8c7339fe79c9d7de9158a0eb9e041579d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index be40eeb58a..59651246e4 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1445,8 +1445,12 @@ void QQmlObjectCreator::clear()
return;
Q_ASSERT(phase != Startup);
- while (!sharedState->allCreatedObjects.isEmpty())
- delete sharedState->allCreatedObjects.pop();
+ while (!sharedState->allCreatedObjects.isEmpty()) {
+ auto object = sharedState->allCreatedObjects.pop();
+ if (engine->objectOwnership(object) != QQmlEngine::CppOwnership) {
+ delete object;
+ }
+ }
while (sharedState->componentAttached) {
QQmlComponentAttached *a = sharedState->componentAttached;