summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/accessible/qaccessiblecache.cpp6
-rw-r--r--src/gui/accessible/qaccessiblecache_p.h1
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp4
3 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp
index f4242036ce..f11883c370 100644
--- a/src/gui/accessible/qaccessiblecache.cpp
+++ b/src/gui/accessible/qaccessiblecache.cpp
@@ -57,6 +57,12 @@ static void cleanupAccessibleCache()
accessibleCache = nullptr;
}
+QAccessibleCache::~QAccessibleCache()
+{
+ for (QAccessibleInterface *iface: idToInterface.values())
+ delete iface;
+}
+
QAccessibleCache *QAccessibleCache::instance()
{
if (!accessibleCache) {
diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h
index f054ee9678..a976277c1d 100644
--- a/src/gui/accessible/qaccessiblecache_p.h
+++ b/src/gui/accessible/qaccessiblecache_p.h
@@ -68,6 +68,7 @@ class Q_GUI_EXPORT QAccessibleCache :public QObject
Q_OBJECT
public:
+ ~QAccessibleCache() override;
static QAccessibleCache *instance();
QAccessibleInterface *interfaceForId(QAccessible::Id id) const;
QAccessible::Id idForInterface(QAccessibleInterface *iface) const;
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index b5d45adadb..a593deb90e 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -876,6 +876,10 @@ void tst_QAccessibility::applicationTest()
QCOMPARE(interface->child(1), static_cast<QAccessibleInterface*>(0));
QCOMPARE(interface->childCount(), 0);
+ // Check that asking for the application interface twice returns the same object
+ QAccessibleInterface *app2 = QAccessible::queryAccessibleInterface(qApp);
+ QCOMPARE(interface, app2);
+
QWidget widget;
widget.show();
qApp->setActiveWindow(&widget);