diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-11 12:42:47 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-01-19 12:47:55 +0100 |
commit | d54285f9e430a8e32cb8f17a3e427be24c3dbfc1 (patch) | |
tree | bbb316c5348b252fcd99c0b007dc7215a77bd9a3 /src | |
parent | 9028f0680d14f4d35a9cb0648b3027b9ffb90cf6 (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.
(adapted from commit 720ffaeb60d43123522066e1de3a69ad551644aa in
qtdeclarative)
Fixes: QTBUG-99644
Change-Id: I9dc6ecc3636ee14f792dca8fa2d4bb5b3cdb3fa9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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 e2b312b2..64428bda 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -399,6 +399,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 6a9124da..5d9f9324 100644 --- a/src/quicktemplates2/qquickabstractbutton_p_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p_p.h @@ -110,6 +110,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; |