diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-09-27 18:19:34 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-09-30 20:26:35 +0200 |
| commit | 76ce5e4799f07e7cf4b9ffccf7cdfb5bc07de3c4 (patch) | |
| tree | 27d550d2118d9d7d542631eed033035bdba16440 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | f8e68c4cd00d3ec36c21acc1cd089ae25af1c17d (diff) | |
QmlCompiler: Do not cache composite metatypes in static members
The metatypes from any old engines may have been deleted.
Retrieve the types from the ResolveTypeReferenceMap instead. That is
much cheaper than doing a full type search and the CU should know the
types it's dealing with.
Sometimes, however, the CU does not pre-resolve the types. In
particular, types only used in function signatures do not end up in the
ResolvedTypeReferenceMap. In those cases, still do the full type search.
Amends commit 8bf5aae19b77b618f3f7a55a59e87c8a319475a8.
Pick-to: 6.8.0 6.8
Task-number: QTBUG-129388
Change-Id: I27f25e1c68de3c752d00345c6d94016fb315e16c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index eab0a70abd..824ad72601 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -139,6 +139,7 @@ private slots: void interestingFiles_data(); void internalConversion(); void invalidPropertyType(); + void invalidateCompositeType(); void invisibleBase(); void invisibleListElementType(); void invisibleSingleton(); @@ -2653,6 +2654,25 @@ void tst_QmlCppCodegen::invalidPropertyType() QVERIFY(myCppType->useListDelegate()); } +void tst_QmlCppCodegen::invalidateCompositeType() +{ + for (int i = 0; i < 3; ++i) { + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/invalidateCompositeType.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(o); + + QObject *d = o->property("d").value<QObject *>(); + QVERIFY(d); + QCOMPARE(o->property("d2").value<QObject *>(), d); + + QObject *group = d->property("child2").value<QObject *>(); + QVERIFY(group); + QCOMPARE(o->property("d3").value<QObject *>(), group); + } +} + void tst_QmlCppCodegen::invisibleBase() { QQmlEngine engine; |
