aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/data/singletonModelLifetime.qml
blob: f2307867238cd198533c639e70dab719ce6ce4a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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()
}