diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-05-03 17:49:56 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-05-05 22:24:52 +0200 |
commit | 567130e2d06a37b8615db7858050dfa0579ced93 (patch) | |
tree | 6b86f0560eee6656e40748192423465a06153681 /tests/auto | |
parent | 30cf4b2b579a3735a59192e2c6ee7d0356cec195 (diff) | |
download | qtdeclarative-567130e2d06a37b8615db7858050dfa0579ced93.tar.gz |
QML: Don't crash when monitoring binding removal
There are more bindings kinds around.
Fixes: QTBUG-113353
Change-Id: If545f56bd61c238431883be3eb013841d96b18bb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml | 21 | ||||
-rw-r--r-- | tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp | 8 |
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml b/tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml new file mode 100644 index 0000000000..8d15185506 --- /dev/null +++ b/tests/auto/qml/qqmlbinding/data/bindingOverwriting2.qml @@ -0,0 +1,21 @@ +pragma ComponentBehavior: Bound +import QtQuick + +ListView { + id: list + property int i: 0 + + model: 1 + delegate: Item { + id: cellRootID + required property int index + Timer { + interval: 1 + running: true + onTriggered: { + cellRootID.index = index + 123 + list.i = cellRootID.index + } + } + } +} diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 2d6d47c5b1..237a92f070 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -459,9 +459,15 @@ void tst_qqmlbinding::bindingOverwriting() QQmlComponent c(&engine, testFileUrl("bindingOverwriting.qml")); QScopedPointer<QQuickItem> item {qobject_cast<QQuickItem*>(c.create())}; QVERIFY(item); + QCOMPARE(messageHandler.messages().size(), 2); + + QQmlComponent c2(&engine, testFileUrl("bindingOverwriting2.qml")); + QScopedPointer<QObject> o(c2.create()); + QVERIFY(o); + QTRY_COMPARE(o->property("i").toInt(), 123); + QCOMPARE(messageHandler.messages().size(), 3); QLoggingCategory::setFilterRules(QString()); - QCOMPARE(messageHandler.messages().size(), 2); } void tst_qqmlbinding::bindToQmlComponent() |