aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlproperty
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-02-16 15:49:37 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-02-19 08:03:13 +0100
commit1ff376e64bf5af6df7e0079700d2b9164037dc89 (patch)
tree4df0dc21531b2bfa0f8f8162a8865ca7d1ca6d40 /tests/auto/qml/qqmlproperty
parent3670395af58f21f203ce2289a04feef7c6de53f5 (diff)
QQmlPropertyPrivate::signalExpression: handle object being null
QQmlData::get expects a non-null pointer, therefore we need to check whether the object still exists. Note that while this fixes the crash in the referenced bug, PropertyChanges still does not support a dynamic target. Pick-to: 5.12 5.15 6.0 6.1 Task-number: QTBUG-46350 Change-Id: Ifeecf5df83e87468a1d314ce2b120006124d6f4b Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlproperty')
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 7177089d7c..4968d4e97f 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -195,6 +195,8 @@ private slots:
void nestedQQmlPropertyMap();
void underscorePropertyChangeHandler();
+
+ void signalExpressionWithoutObject();
private:
QQmlEngine engine;
};
@@ -2263,6 +2265,14 @@ void tst_qqmlproperty::underscorePropertyChangeHandler()
QVERIFY(changeHandler.isSignalProperty());
}
+void tst_qqmlproperty::signalExpressionWithoutObject()
+{
+ QQmlProperty invalid;
+ QQmlPropertyPrivate::setSignalExpression(invalid, nullptr);
+ QQmlBoundSignalExpression *expr = QQmlPropertyPrivate::signalExpression(invalid);
+ QVERIFY(!expr);
+}
+
QTEST_MAIN(tst_qqmlproperty)
#include "tst_qqmlproperty.moc"