aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml20
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp11
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml b/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml
new file mode 100644
index 0000000000..1a2a7ff341
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/CachedGetterLookup.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.12
+
+QtObject {
+ Component.onCompleted: {
+ // create getter
+ var getFoo = function(o) { return o.foo; }
+
+ // create two diffrent shapes for x,y
+ var x = { foo:1 , bar:2 }
+ var y = { bar:2 , foo:1 }
+
+ // initialize inline cache with getFoo
+ getFoo(x);
+ getFoo(y);
+
+ // hit getter lookup with string "crash"
+ getFoo('crash');
+ }
+}
+
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index b9cb6b70d2..0cb6753020 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -81,6 +81,7 @@ private slots:
void cppSignalAndEval();
void singletonInstance();
void aggressiveGc();
+ void cachedGetterLookup_qtbug_75335();
public slots:
QObject *createAQObjectForOwnershipTest ()
@@ -1056,6 +1057,16 @@ void tst_qqmlengine::aggressiveGc()
qputenv("QV4_MM_AGGRESSIVE_GC", origAggressiveGc);
}
+void tst_qqmlengine::cachedGetterLookup_qtbug_75335()
+{
+ QQmlEngine engine;
+ const QUrl testUrl = testFileUrl("CachedGetterLookup.qml");
+ QQmlComponent component(&engine, testUrl);
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != nullptr);
+}
+
QTEST_MAIN(tst_qqmlengine)
#include "tst_qqmlengine.moc"