diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-04-13 13:46:20 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-04-13 18:33:44 +0000 |
commit | 568005a5d3ecd78608d619cc9dc6063276baa316 (patch) | |
tree | f38696990a6a861173429e416b91e4a8b0f9ab09 /tests/auto/qml/qqmlconnections | |
parent | 9c1c471e54bb12e8740b76d1c048f2f916a6ab59 (diff) |
QQmlConnections: Don't crash (or read past bounds) if a silly prop name is given
Change-Id: I156d27b21159f019a969a33e553e63fac9a3d193
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlconnections')
-rw-r--r-- | tests/auto/qml/qqmlconnections/data/connection-no-signal-name.qml | 15 | ||||
-rw-r--r-- | tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlconnections/data/connection-no-signal-name.qml b/tests/auto/qml/qqmlconnections/data/connection-no-signal-name.qml new file mode 100644 index 0000000000..462a9577ff --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/connection-no-signal-name.qml @@ -0,0 +1,15 @@ +import QtQuick 2.4 + +Item { + id: blaBlaBla + function hint() { + } + + Connections { + //target: blaBlaBla + //onHint: hint(); + on: true + } +} + + diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index b3ac1ce958..1ed94fcb93 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -53,6 +53,7 @@ private slots: void singletonTypeTarget(); void enableDisable_QTBUG_36350(); void clearImplicitTarget(); + void onWithoutASignal(); private: QQmlEngine engine; @@ -379,6 +380,15 @@ void tst_qqmlconnections::clearImplicitTarget() delete item; } +void tst_qqmlconnections::onWithoutASignal() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("connection-no-signal-name.qml")); + QVERIFY(c.isError()); // Cannot assign to non-existent property "on" expected + QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(c.create())); + QVERIFY(item == nullptr); // should parse error, and not give us an item (or crash). +} + QTEST_MAIN(tst_qqmlconnections) #include "tst_qqmlconnections.moc" |