diff options
Diffstat (limited to 'src/gui/accessible')
| -rw-r--r-- | src/gui/accessible/linux/qspi_struct_marshallers.cpp | 19 | ||||
| -rw-r--r-- | src/gui/accessible/linux/qspi_struct_marshallers_p.h | 16 | ||||
| -rw-r--r-- | src/gui/accessible/qaccessible_base.h | 4 | ||||
| -rw-r--r-- | src/gui/accessible/qaccessiblecache.cpp | 23 |
4 files changed, 25 insertions, 37 deletions
diff --git a/src/gui/accessible/linux/qspi_struct_marshallers.cpp b/src/gui/accessible/linux/qspi_struct_marshallers.cpp index 241bad502e3..5e171244cd0 100644 --- a/src/gui/accessible/linux/qspi_struct_marshallers.cpp +++ b/src/gui/accessible/linux/qspi_struct_marshallers.cpp @@ -28,7 +28,6 @@ QT_IMPL_METATYPE_EXTERN(QSpiRelationArray) QT_IMPL_METATYPE_EXTERN(QSpiTextRange) QT_IMPL_METATYPE_EXTERN(QSpiTextRangeList) QT_IMPL_METATYPE_EXTERN(QSpiAttributeSet) -QT_IMPL_METATYPE_EXTERN(QSpiAppUpdate) QT_IMPL_METATYPE_EXTERN(QSpiDeviceEvent) QT_IMPL_METATYPE_EXTERN(QSpiMatchRule) @@ -134,23 +133,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener return argument; } -/* QSpiAppUpdate */ -/*---------------------------------------------------------------------------*/ - -QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update) { - argument.beginStructure(); - argument << update.type << update.address; - argument.endStructure(); - return argument; -} - -const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update) { - argument.beginStructure(); - argument >> update.type >> update.address; - argument.endStructure(); - return argument; -} - /* QSpiRelationArrayEntry */ /*---------------------------------------------------------------------------*/ @@ -245,7 +227,6 @@ void qSpiInitializeStructTypes() qDBusRegisterMetaType<QSpiEventListenerArray>(); qDBusRegisterMetaType<QSpiDeviceEvent>(); qDBusRegisterMetaType<QSpiMatchRule>(); - qDBusRegisterMetaType<QSpiAppUpdate>(); qDBusRegisterMetaType<QSpiRelationArrayEntry>(); qDBusRegisterMetaType<QSpiRelationArray>(); } diff --git a/src/gui/accessible/linux/qspi_struct_marshallers_p.h b/src/gui/accessible/linux/qspi_struct_marshallers_p.h index fe2d52fb4c2..4c446a97040 100644 --- a/src/gui/accessible/linux/qspi_struct_marshallers_p.h +++ b/src/gui/accessible/linux/qspi_struct_marshallers_p.h @@ -106,21 +106,6 @@ Q_DECLARE_TYPEINFO(QSpiTextRange, Q_RELOCATABLE_TYPE); typedef QList<QSpiTextRange> QSpiTextRangeList; typedef QMap <QString, QString> QSpiAttributeSet; -enum QSpiAppUpdateType { - QSPI_APP_UPDATE_ADDED = 0, - QSPI_APP_UPDATE_REMOVED = 1 -}; -Q_DECLARE_TYPEINFO(QSpiAppUpdateType, Q_PRIMITIVE_TYPE); - -struct QSpiAppUpdate { - int type; /* Is an application added or removed */ - QString address; /* D-Bus address of application added or removed */ -}; -Q_DECLARE_TYPEINFO(QSpiAppUpdate, Q_RELOCATABLE_TYPE); - -QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update); -const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update); - struct QSpiDeviceEvent { unsigned int type; int id; @@ -171,7 +156,6 @@ QT_DECL_METATYPE_EXTERN(QSpiRelationArray, /* not exported */) QT_DECL_METATYPE_EXTERN(QSpiTextRange, /* not exported */) QT_DECL_METATYPE_EXTERN(QSpiTextRangeList, /* not exported */) QT_DECL_METATYPE_EXTERN(QSpiAttributeSet, /* not exported */) -QT_DECL_METATYPE_EXTERN(QSpiAppUpdate, /* not exported */) QT_DECL_METATYPE_EXTERN(QSpiDeviceEvent, /* not exported */) QT_DECL_METATYPE_EXTERN(QSpiMatchRule, /* not exported */) 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 a8255e04c02..311b53aeaa3 100644 --- a/src/gui/accessible/qaccessiblecache.cpp +++ b/src/gui/accessible/qaccessiblecache.cpp @@ -4,6 +4,7 @@ #include "qaccessiblecache_p.h" #include <QtCore/qdebug.h> #include <QtCore/qloggingcategory.h> +#include <private/qguiapplication_p.h> #if QT_CONFIG(accessibility) @@ -176,10 +177,28 @@ void QAccessibleCache::sendObjectDestroyedEvent(QObject *obj) void QAccessibleCache::deleteInterface(QAccessible::Id id, QObject *obj) { - QAccessibleInterface *iface = idToInterface.take(id); + const auto it = idToInterface.find(id); + if (it == idToInterface.end()) // the interface may be deleted already + return; + + QAccessibleInterface *iface = *it; qCDebug(lcAccessibilityCache) << "delete - id:" << id << " iface:" << iface; - if (!iface) // the interface may be deleted already + if (!iface) { + idToInterface.erase(it); return; + } + + // QObjects sends this from their destructor, but + // the object less interfaces calls deleteInterface + // directly + if (!obj && !iface->object()) { + if (QGuiApplicationPrivate::is_app_running && !QGuiApplicationPrivate::is_app_closing && QAccessible::isActive()) { + QAccessibleObjectDestroyedEvent event(id); + QAccessible::updateAccessibility(&event); + } + } + + idToInterface.erase(it); interfaceToId.take(iface); if (!obj) obj = iface->object(); |
