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>
bb10
Frederik Gladhorn 2018-07-05 11:28:01 +02:00
parent f98ee77cd3
commit 2a00a5d70b
2 changed files with 9 additions and 1 deletions

View File

@ -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; }

View File

@ -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;