diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-07-05 11:28:01 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-07-08 06:37:43 +0000 |
commit | 2a00a5d70b1b9ff2033463b740b5f1bc07d6118c (patch) | |
tree | 58e3ad6a838a16a59504f3b8b0bf504fa274a4a5 | |
parent | f98ee77cd3e9964b995d063345a895e537bc1157 (diff) |
QAccessibleTabButton: fix isValid
The button interface is faking everything to represent the buttons when
it comes to accessibility, since they are not represented by a QWidget.
When the parent TabBar is in its destructor, isValid should return false
to prevent accessing it.
Task-number: QTBUG-69283
Change-Id: Ifedf3fa45f9106723afb0b04922b071a3c5467c3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/widgets/accessible/complexwidgets.cpp | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 1499ab827c..63c6fbb9bb 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -120,7 +120,14 @@ public: return rec; } - bool isValid() const override { return m_parent.data() && m_parent->count() > m_index; } + bool isValid() const override { + if (m_parent) { + if (static_cast<QWidget *>(m_parent.data())->d_func()->data.in_destructor) + return false; + return m_parent->count() > m_index; + } + return false; + } QAccessibleInterface *childAt(int, int) const override { return 0; } int childCount() const override { return 0; } diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 9f9f167002..9d5fe89c70 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -714,6 +714,7 @@ private: friend class QWidgetWindow; friend class QAccessibleWidget; friend class QAccessibleTable; + friend class QAccessibleTabButton; #ifndef QT_NO_GESTURES friend class QGestureManager; friend class QWinNativePanGestureRecognizer; |