From 2a00a5d70b1b9ff2033463b740b5f1bc07d6118c Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 5 Jul 2018 11:28:01 +0200 Subject: 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 --- src/widgets/accessible/complexwidgets.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/widgets/accessible') 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(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; } -- cgit v1.2.3