fix QML property cache leaks of delegate items
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Wed, 18 Aug 2021 11:21:46 +0000 (12:21 +0100)
committerDmitry Shachnev <mitya57@debian.org>
Wed, 18 Aug 2021 11:21:46 +0000 (12:21 +0100)
commitcd9fd2c0ac426aad81da454fb234105e827a88af
tree015353aa1f39f7903429392a1b82fcb9e8a449a1
parentc2ebcaabac5b563019ebdac7ed4d1852abb3684c
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