aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcontext/data
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-11-29 11:28:49 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-11-30 09:09:36 +0000
commitb17091b0006e41c0bb4ddf77dbbc09621d809aea (patch)
treefd27f9b48ee209b13d545fa8df46d147b0566d24 /tests/auto/qml/qqmlcontext/data
parentd0a52c72b5756787ceb6094117cd71d935badc06 (diff)
QML: Also clear outerContext's contextObject on destruction
A QObject can not only be set as contextObject of the own context, but also as contextObject of the outerContext of a respective QQmlData. This can be seen in QQmlObjectCreator::createInstance(...) if isContextObject is true. Therefore, when catching a QObject deletion we need to clear the pointer in the outerContext if that refers to the object being deleted. Fixes: QTBUG-71037 Change-Id: Ib6ba99bd5336f7582486b2128515021245370c60 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlcontext/data')
-rw-r--r--tests/auto/qml/qqmlcontext/data/MyItem.qml5
-rw-r--r--tests/auto/qml/qqmlcontext/data/outerContextObject.qml18
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcontext/data/MyItem.qml b/tests/auto/qml/qqmlcontext/data/MyItem.qml
new file mode 100644
index 0000000000..2ffd984dfa
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/MyItem.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ Component.onCompleted: 5 + 5
+}
diff --git a/tests/auto/qml/qqmlcontext/data/outerContextObject.qml b/tests/auto/qml/qqmlcontext/data/outerContextObject.qml
new file mode 100644
index 0000000000..992b760915
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/outerContextObject.qml
@@ -0,0 +1,18 @@
+import QtQml 2.2
+
+QtObject {
+ id: window
+
+ property Component itemComponent: Qt.createComponent("MyItem.qml")
+ property MyItem item
+
+ property Timer timer: Timer {
+ running: true
+ interval: 10
+ repeat: true
+ onTriggered: {
+ item = itemComponent.createObject(null, {});
+ gc();
+ }
+ }
+}