aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:07 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:07 +0200
commit19ed7973a311a8d42d3a558bb551230e902ce9b9 (patch)
tree9832c0cc796722f85579e25fd50cc38b65e6ef6c /tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
parentf5701f0def37fcc0c2b38ae9552eb3a896a34687 (diff)
parenta5635345175e667601c8b6a344508c4d4ebb0f9d (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Diffstat (limited to 'tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml')
-rw-r--r--tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml b/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
new file mode 100644
index 0000000000..f230786723
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.15
+import QtQuick.Window 2.15
+import test 1.0
+
+Window {
+ id: root
+ visible: true
+ width: 800
+ height: 680
+ property bool alive: false
+
+ Component {
+ id: view
+ ListView {
+ model: SingletonModel
+ }
+ }
+ function compare(a,b) {
+ root.alive = (a === b)
+ }
+
+ function test_singletonModelCrash() {
+ SingletonModel.objectName = "model"
+ var o = view.createObject(root)
+ o.destroy()
+ Qt.callLater(function() {
+ compare(SingletonModel.objectName, "model")
+ })
+ }
+
+ Component.onCompleted: root.test_singletonModelCrash()
+}