diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-11-16 16:30:39 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-05-07 16:46:49 +0000 |
commit | 02830aae1f3e9aaf89ca37637d40313babbff7b8 (patch) | |
tree | 638a9516791af32b6625c39b8939fa373b834f1e /tests/auto | |
parent | 7286b296f97d3394f3c2a716116bd483c9874931 (diff) |
Don't crash: Connections with a signal on a nonexistent object
Task-number: QTBUG-56551
Change-Id: Ide09f177d3f6a3e9902f8ea904b3e6e4b998bd39
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml | 11 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 10 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml b/tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml new file mode 100644 index 0000000000..ed0632a68a --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml @@ -0,0 +1,11 @@ +import QtQuick 2.4 + +Item { + function hint() { + } + + Connections { + target: BlaBlaBla + onHint: hint(); + } +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index cc74b7e07d..09e89ff85f 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -98,6 +98,7 @@ private slots: void mapCoordinatesRect(); void mapCoordinatesRect_data(); void propertyChanges(); + void nonexistentPropertyConnection(); void transforms(); void transforms_data(); void childrenRect(); @@ -2612,6 +2613,15 @@ void tst_QQuickItem::propertyChanges() delete window; } +void tst_QQuickItem::nonexistentPropertyConnection() +{ + // QTBUG-56551: don't crash + QQmlComponent component(&engine, testFileUrl("nonexistentPropertyConnection.qml")); + QObject *o = component.create(); + QVERIFY(o); + delete o; +} + void tst_QQuickItem::childrenRect() { QQuickView *window = new QQuickView(0); |