diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-08-11 11:43:55 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-09-02 09:15:02 +0200 |
| commit | 2d016a2653c59f10a57dc1903b817f71d16d0622 (patch) | |
| tree | 3f91fdb4756443da56654ac514d95b15b7ac0910 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | 9148ab4d8dd2fe4221aca1f1e2af1ad17835b6bd (diff) | |
QtQml: Mark values on the AOT-compiled stack during gc
Keep them in a special generated struct with virtual method that gets
called from the GC for each frame.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-139059
Change-Id: I81bcbeab6531e174a5207d03f57d241461ae9ba3
Reviewed-by: Olivier De Cannière <olivier.decanniere@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 7e116e9d6f..243b6b1296 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -72,6 +72,7 @@ private slots: void callContextPropertyLookupResult(); void callObjectLookupOnNull(); void callWithSpread(); + void collectGarbageDuringAotCode(); void colorAsVariant(); void colorString(); void compareOriginals(); @@ -1100,6 +1101,25 @@ void tst_QmlCppCodegen::callWithSpread() QVERIFY(!o.isNull()); } +void tst_QmlCppCodegen::collectGarbageDuringAotCode() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/collector.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); + + QObject *inner = o->property("o").value<QObject *>(); + QVERIFY(inner); + QCOMPARE(inner->objectName(), u"dynamic"_s); + + inner = o->property("o2").value<QObject *>(); + QVERIFY(inner); + QCOMPARE(inner->objectName(), u"dynamic"_s); + + QCOMPARE(o->property("gcRun").toInt(), 1); +} + void tst_QmlCppCodegen::colorAsVariant() { QQmlEngine engine; |
