diff options
author | Sami Shalayel <sami.shalayel@qt.io> | 2022-09-06 16:01:28 +0200 |
---|---|---|
committer | Sami Shalayel <sami.shalayel@qt.io> | 2022-09-07 09:58:00 +0000 |
commit | e0a00a691963e2c684f4dd857d042a3ffbebe959 (patch) | |
tree | bfa753723863c76fa9d1fd2b7df756ced4324335 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | 5e8b7627565d408ed6dbd9f3a192d0bbeff6720e (diff) |
QQmlVMEMetaObjectEndpoint: ensure property cache before accessing it
Otherwise the property cache might be null and lead to segmentation
faults, e.g. when declaring aliases in qml.
Fixes: QTBUG-106256
Change-Id: I568c973e1ba00531fbe22a41e2c6c3c09dfc2f02
Pick-to: 6.2 6.3 6.4 5.15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 44043ad02e..2bed1dc930 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -393,6 +393,7 @@ private slots: void v4SequenceMethodsWithParams_data(); void v4SequenceMethodsWithParams(); void jsFunctionOverridesImport(); + void bindingAliasToComponentUrl(); private: QQmlEngine engine; @@ -7605,6 +7606,25 @@ void tst_qqmllanguage::jsFunctionOverridesImport() QCOMPARE(object->objectName(), u"foo"_s); } +void tst_qqmllanguage::bindingAliasToComponentUrl() +{ + QQmlEngine engine; + { + QQmlComponent component(&engine, testFileUrl("bindingAliasToComponentUrl.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object); + QCOMPARE(object->property("accessibleNormalUrl"), object->property("urlClone")); + } + { + QQmlComponent component(&engine, testFileUrl("bindingAliasToComponentUrl2.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object); + QCOMPARE(object->property("accessibleNormalProgress"), QVariant(1.0)); + } +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |