Workaround ChangeListener getting called on semi-deleted objects

Without this change, the emit in itemVisibilityChanged would trigger
QFATAL : tst_controls::Basic::Dialog::test_layout()
ASSERT failure in QQuickDialog: "Called object is not of the correct type
(class destructor may have already run)"
in tst_basic, as the object was already semi-destroyed.

Task-number: QTBUG-98790
Change-Id: I112df9da0c07a1f9c14b8d557c1c1c19405d3180
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Fabian Kosmale 2021-11-30 12:04:16 +01:00
parent 459a0059a3
commit 74d2ed9203
1 changed files with 2 additions and 0 deletions

View File

@ -164,6 +164,8 @@ void QQuickPagePrivate::itemVisibilityChanged(QQuickItem *item)
{
Q_Q(QQuickPage);
QQuickPanePrivate::itemVisibilityChanged(item);
if (QQmlData::wasDeleted(q))
return;
if (item == header) {
QBoolBlocker signalGuard(emittingImplicitSizeChangedSignals);
emit q->implicitHeaderWidthChanged();