summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible/qaccessible.cpp
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2020-05-14 12:03:54 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2020-05-19 13:33:02 +0200
commit5b3a86a87b628236fcb6be150e94e2229ce3445d (patch)
tree7b9b4d32089b28397537a0e392cfc64a61b5b931 /src/gui/accessible/qaccessible.cpp
parent3dc3c0e2b66eb452cfde2c0702295dc6806a51fa (diff)
a11y: Fix bug in the accessibility cache
We could sometimes cache a partially constructed object if the accessibility interface for that was created during construction time of the object. This usually ended up in that the interface for e.g. QMenuBar was stored in the cache as a QAccessibleWidget, regardless of if the a11y factory supported it. Since it was already in the cache, it remained the same for the entire lifetime of the application, causing e.g. QMenuBar not have the correct accessibility behavior. Task-number: QTBUG-83993 Change-Id: I72b2d5a93f6b397fd3666d45951109e3e5aff754 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'src/gui/accessible/qaccessible.cpp')
-rw-r--r--src/gui/accessible/qaccessible.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 973c19b3bf..24c9e023f9 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -674,7 +674,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
if (!object)
return nullptr;
- if (Id id = QAccessibleCache::instance()->objectToId.value(object))
+ if (Id id = QAccessibleCache::instance()->idForObject(object))
return QAccessibleCache::instance()->interfaceForId(id);
// Create a QAccessibleInterface for the object class. Start by the most
@@ -688,7 +688,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
InterfaceFactory factory = qAccessibleFactories()->at(i - 1);
if (QAccessibleInterface *iface = factory(cn, object)) {
QAccessibleCache::instance()->insert(object, iface);
- Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(object));
+ Q_ASSERT(QAccessibleCache::instance()->containsObject(object));
return iface;
}
}
@@ -709,7 +709,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
QAccessibleInterface *result = factory->create(cn, object);
if (result) { // Need this condition because of QDesktopScreenWidget
QAccessibleCache::instance()->insert(object, result);
- Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(object));
+ Q_ASSERT(QAccessibleCache::instance()->containsObject(object));
}
return result;
}
@@ -719,7 +719,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
if (object == qApp) {
QAccessibleInterface *appInterface = new QAccessibleApplication;
QAccessibleCache::instance()->insert(object, appInterface);
- Q_ASSERT(QAccessibleCache::instance()->objectToId.contains(qApp));
+ Q_ASSERT(QAccessibleCache::instance()->containsObject(qApp));
return appInterface;
}