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>
This commit is contained in:
Gabriel de Dietrich 2016-02-26 13:56:55 -08:00
parent 0aed4fd941
commit afe3c30759

View File

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