fix AT_SPI_BUS_ADDRESS actually working

the previous invocation wasn't working because QSpiAccessibleBridge
first needs to construct the connection before it can connect to the
enabledChanged signal that gets emitted as part of connectA11yBus,
effectively missing the signal emission because the connection wasn't
established by the time the emit happens. delay the signal emission
through the eventloop so the caller has time to connect to all signals.

https://bugs.kde.org/show_bug.cgi?id=452132

Change-Id: I1cf9fdd824b2c118cc6278b207aaaedeff259bb1
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
This commit is contained in:
Harald Sitter 2022-07-18 12:26:36 +02:00
parent 2f4204238c
commit be09628e15

View File

@ -38,8 +38,15 @@ DBusConnection::DBusConnection(QObject *parent)
// If the bus is explicitly set via env var it overrides everything else.
QByteArray addressEnv = qgetenv("AT_SPI_BUS_ADDRESS");
if (!addressEnv.isEmpty()) {
// Only connect on next loop run, connections to our enabled signal are
// only established after the ctor returns.
metaObject()->invokeMethod(
this,
[this, addressEnv] {
m_enabled = true;
connectA11yBus(QString::fromLocal8Bit(addressEnv));
},
Qt::QueuedConnection);
return;
}