a11y: fix race condition on atspi startup on Wayland

This amends db346e711c .

Previously we could race between dbus connecting and our "manual"
enabled call since we didn't take into account whether dbus is
connected or not.

This lead to scenarios where opening an application (in particular under
Wayland) would result in the application not being able to register on
the a11y bus because registration was attempted too early.
By simply taking connectedness into account we'll make sure to not
run registration too early anymore.

Pick-to: 6.6 6.5
Change-Id: I46a3c0b57f8a0c83d3e5fae9e355c2061954031f
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Harald Sitter 2023-08-01 13:56:24 +02:00 committed by Liang Qi
parent 8615884728
commit 918fed3915

View File

@ -38,7 +38,7 @@ QSpiAccessibleBridge::QSpiAccessibleBridge()
// But do that only on next loop, once dbus is really settled.
QTimer::singleShot(
0, this, [this]{
if (dbusConnection->isEnabled())
if (dbusConnection->isEnabled() && dbusConnection->connection().isConnected())
enabledChanged(true);
});
}