diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-11 12:42:47 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-14 13:46:40 +0000 |
commit | bfb3f8f71b5ae5eccca5fffbb0de2ab76db1e91f (patch) | |
tree | ffb53d4c1d407392634a46a31af2df60b6b2a999 /src | |
parent | af7f92a348289bff055cc34357b049b18c5033f3 (diff) |
QQuickAbstractButton: fix crash on destruction
If we listen for size changes we also need to remove the object listened
to when it's deleted.
Fixes: QTBUG-99644
Change-Id: I613855ebd986b1e67685088020b88d8b070659cf
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 720ffaeb60d43123522066e1de3a69ad551644aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton.cpp | 11 | ||||
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton_p_p.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index 04062312dc..191dd81b0b 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -429,6 +429,17 @@ void QQuickAbstractButtonPrivate::itemImplicitHeightChanged(QQuickItem *item) emit q->implicitIndicatorHeightChanged(); } +void QQuickAbstractButtonPrivate::itemDestroyed(QQuickItem *item) +{ + Q_Q(QQuickAbstractButton); + QQuickControlPrivate::itemDestroyed(item); + if (item == indicator) { + indicator = nullptr; + emit q->implicitIndicatorWidthChanged(); + emit q->implicitIndicatorHeightChanged(); + } +} + QQuickAbstractButton *QQuickAbstractButtonPrivate::findCheckedButton() const { Q_Q(const QQuickAbstractButton); diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h index 7fc2e4066b..700a45ab41 100644 --- a/src/quicktemplates2/qquickabstractbutton_p_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p_p.h @@ -113,6 +113,7 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; + void itemDestroyed(QQuickItem *item) override; // copied from qabstractbutton.cpp static const int AUTO_REPEAT_DELAY = 300; |