summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2016-02-26 13:56:55 -0800
committerGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2016-03-02 19:26:06 +0000
commitafe3c30759d1bf9f52278d8dc40f85a93a1d963b (patch)
tree53f35c6d9782aeb3a0e52b2f5b2641c1d9aed6ba
parent0aed4fd941c610517a68447cafa474a0c26ff2d2 (diff)
Don't create accessible interface for QWidgets being destroyed
Change-Id: I975ee556913707e8595b2a89f1bba4299187bcfb Reviewed-by: Wayne Arnold <wayne.arnold@autodesk.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index 4fa7c89482..261bc69000 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -33,6 +33,7 @@
#include "qaccessiblewidgets_p.h"
#include "qaccessiblemenu_p.h"
+#include "private/qwidget_p.h"
#include "simplewidgets_p.h"
#include "rangecontrols_p.h"
#include "complexwidgets_p.h"
@@ -53,7 +54,15 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
QAccessibleInterface *iface = 0;
if (!object || !object->isWidgetType())
return iface;
+
QWidget *widget = static_cast<QWidget*>(object);
+ // QWidget emits destroyed() from its destructor instead of letting the QObject
+ // destructor do it, which means the QWidget is unregistered from the accessibillity
+ // cache. But QWidget destruction also emits enter and leave events, which may end
+ // up here, so we have to ensure that we don't fill the cache with an entry of
+ // a widget that is going away.
+ if (QWidgetPrivate::get(widget)->data.in_destructor)
+ return iface;
if (false) {
#ifndef QT_NO_LINEEDIT