diff options
Diffstat (limited to 'src/gui/accessible')
| -rw-r--r-- | src/gui/accessible/qaccessible_base.h | 4 | ||||
| -rw-r--r-- | src/gui/accessible/qaccessiblecache.cpp | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/accessible/qaccessible_base.h b/src/gui/accessible/qaccessible_base.h index 3881c6346a0..04efeddf06f 100644 --- a/src/gui/accessible/qaccessible_base.h +++ b/src/gui/accessible/qaccessible_base.h @@ -175,11 +175,15 @@ public: // quint64 alertMedium : 1; // quint64 alertHigh : 1; + Q_DECL_UNUSED_MEMBER quint64 qt_reserved : 27; + State() { std::memset(this, 0, sizeof(State)); } friend inline bool operator==(const QAccessible::State &first, const QAccessible::State &second) { + static_assert(std::has_unique_object_representations_v<State>, + "memcmp() cannot be used on types with padding"); return std::memcmp(&first, &second, sizeof(QAccessible::State)) == 0; } }; diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp index 311b53aeaa3..b5dcdca6270 100644 --- a/src/gui/accessible/qaccessiblecache.cpp +++ b/src/gui/accessible/qaccessiblecache.cpp @@ -19,6 +19,7 @@ Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCache, "qt.accessibility.cache"); */ static QAccessibleCache *accessibleCache = nullptr; +static bool inCacheDestructor = false; static void cleanupAccessibleCache() { @@ -32,6 +33,8 @@ QAccessibleObjectDestroyedEvent::~QAccessibleObjectDestroyedEvent() QAccessibleCache::~QAccessibleCache() { + inCacheDestructor = true; + for (QAccessible::Id id: idToInterface.keys()) deleteInterface(id); } @@ -188,10 +191,9 @@ void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj) return; } - // QObjects sends this from their destructor, but - // the object less interfaces calls deleteInterface - // directly - if (!obj && !iface->object()) { + // QObjects send this from their destructors, but the interfaces + // with no associated object call deleteInterface directly. + if (!inCacheDestructor && !obj && !iface->object()) { if (QGuiApplicationPrivate::is_app_running && !QGuiApplicationPrivate::is_app_closing && QAccessible::isActive()) { QAccessibleObjectDestroyedEvent event(id); QAccessible::updateAccessibility(&event); |
