From b9d37a328ba09bcb2a7a95b5778cb8c63d0ace26 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 21 Nov 2023 19:36:26 +0100 Subject: Long live incremental garbage collection in QML! The design of the garbage collector is described in src/qml/memory/design.md. The gc and gcdone test helpers are adjusted to drive the gc to completion, even when in incremental mode. Parts of tst_qv4mm and tst_qqmlqt need to run with the incremental gc disabled, as they call gc inside QML and assumes that the GC finishes before returning. Initial-patch-by: Rafal Chomentowski Task-number: QTBUG-119274 Change-Id: I1d94f41bc7a434fad67de0fd46454b6db285f2eb Reviewed-by: Ulf Hermann --- src/quicktestutils/qml/qmlutils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/quicktestutils/qml/qmlutils.cpp') diff --git a/src/quicktestutils/qml/qmlutils.cpp b/src/quicktestutils/qml/qmlutils.cpp index 6cc54af356..64edc91a1c 100644 --- a/src/quicktestutils/qml/qmlutils.cpp +++ b/src/quicktestutils/qml/qmlutils.cpp @@ -112,14 +112,14 @@ QQmlTestMessageHandler::~QQmlTestMessageHandler() bool gcDone(const QV4::ExecutionEngine *engine) { - // always true as long as the gc is non-incremental - Q_UNUSED(engine); - return true; + return !engine->memoryManager->gcStateMachine->inProgress(); } void gc(QV4::ExecutionEngine &engine, GCFlags flags) { engine.memoryManager->runGC(); + while (!gcDone(&engine)) + engine.memoryManager->gcStateMachine->step(); if (int(GCFlags::DontSendPostedEvents) & int(flags)) return; QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); -- cgit v1.2.3