Skip to content

QQuickItem: avoid emitting signals during destruction

Fushan Wen requested to merge (removed):work/fuf/blocksignals into kde/5.15

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.

Task-number: QTBUG-107850 Change-Id: I36ea98842c89ad89fcc1c4a328d138f66f2a0446 Reviewed-by: default avatarShawn Rutledge Reviewed-by: Mitch Curtis's avatarMitch Curtis (cherry picked from commit 74873324)

Build log:

Edited by Fushan Wen

Merge request reports