From be09628e151f26f602024bae6a957ffb27ac872d Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Mon, 18 Jul 2022 12:26:36 +0200 Subject: [PATCH] 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 --- src/gui/accessible/linux/dbusconnection.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/accessible/linux/dbusconnection.cpp b/src/gui/accessible/linux/dbusconnection.cpp index b4a8643474e..a970c2758bb 100644 --- a/src/gui/accessible/linux/dbusconnection.cpp +++ b/src/gui/accessible/linux/dbusconnection.cpp @@ -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()) { - m_enabled = true; - connectA11yBus(QString::fromLocal8Bit(addressEnv)); + // 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; }