QQuickItem: avoid emitting signals during destruction
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Thu, 7 Nov 2024 08:47:17 +0000 (11:47 +0300)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 7 Nov 2024 08:47:17 +0000 (11:47 +0300)
commita3132e6b5418f268dbf1646d3b53d8a903c535e4
tree4b8a7070b2c66c9372ca4d5127196481abc28a5f
parentea0f02a601a61d9a1cdd3aa338f3527443c349b5
QQuickItem: avoid emitting signals during destruction

Origin: upstream, https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=74873324bdf33997
Last-Update: 2023-02-26

If a QQuickItem is in the QQuickItem destructor, then it is both unsafe
and unnecessary to emit property change notifications. Connected code
can no longer rely on the state of the emitting object - if it was
originally a subclass of QQuickItem, then those subclass destructors
will already have run. And the QQuickItem destructor will also have
partially run, leaving the object in an undefined state.

Add a flag that we set to true at the top of ~QQuickItem, and don't emit
visibleChildrenChanged, parentChanged, visibleChanged, and
childrenChanged for items that are partially destroyed already.

[ChangeLog][Qt Quick][QQuickItem] QQuickItem no longer emits change
notifications for the parent, children, visible, and visibleChildren
properties while it is being destroyed.

Gbp-Pq: Name qquickitem_no_signals_on_destruction.patch
src/quick/items/qquickitem.cpp
src/quick/items/qquickitem_p.h
tests/auto/quick/qquickitem2/tst_qquickitem.cpp