fix QML property cache leaks of delegate items
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Tue, 1 Jun 2021 21:37:21 +0000 (22:37 +0100)
committerLisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
Tue, 1 Jun 2021 21:37:21 +0000 (22:37 +0100)
commita5494d61c487c0bd238242164b8146b29ce6a612
treea2466ec15e4ed13ea9eedf1f61036301aeff949e
parentd950df0674bb4e5b4c0be815a64e6bfcd4d0e4a2
fix QML property cache leaks of delegate items

Origin: upstream, https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=b2862e2bd84d651c
Last-Update: 2021-01-26

The delegate items are destroyed through an event loop by a call to a
deleteLater(). This, however, doesn't work when the application is
in the process of exiting and the event loop is already closed (i.e.
we're in a stack unwinding part that starts after app.exec()).

Combat this situation by setting a parent of the to-be-deleted object
to some QObject that will be destroyed e.g. QCoreApplication::instance()
before the program finishes. As QObjects clean their children on
destruction, this will make sure that we cleanup the previously leaking
thing regardless of the event loop.

Gbp-Pq: Name fix_qml_property_cache_leaks.patch
src/qmlmodels/qqmldelegatemodel.cpp
tests/auto/quick/qquickview_extra/data/qtbug_87228.qml [new file with mode: 0644]
tests/auto/quick/qquickview_extra/qquickview_extra.pro [new file with mode: 0644]
tests/auto/quick/qquickview_extra/tst_qquickview_extra.cpp [new file with mode: 0644]
tests/auto/quick/quick.pro