[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1033995: qtbase-opensource-src: Fix accessibility of qt5 applications run as root



Dmitry Shachnev, le jeu. 06 avril 2023 19:10:28 +0300, a ecrit:
> I don't like that this change has not been merged upstream because of
> test failures,

Oh, I didn't notice that there was a recorded test failure.

I don't see how the failure can be related to the change...

Cc-ing Frederik, in case he remembers / realizes something.

> But I looked at the KDE branch, and the last three commits they have there [1]
> seem to be related to the same problem. At least, the comment talks about the
> the same thing as your description:
> 
>     // Only connect on next loop run, connections to our enabled signal are
>     // only established after the ctor returns.
> 
> But these changes depend on AT_SPI_BUS_ADDRESS environment variable. Can we
> rely on it in Debian?

No, that variable is not usually set. root-owned applications get the
bus address from the X11 root window property.

It's unfortunate that this fix didn't see Frederik's patch which should
be way more straightforward to fix things.

Samuel

> --
> Dmitry Shachnev

> diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
> index 45ddc8e496..cc734abc63 100644
> --- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp
> +++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
> @@ -69,6 +69,21 @@ QT_BEGIN_NAMESPACE
>  DBusConnection::DBusConnection(QObject *parent)
>      : QObject(parent), m_a11yConnection(QString()), m_enabled(false)
>  {
> +    // 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.
> +        QMetaObject::invokeMethod(
> +                this,
> +                [this, addressEnv] {
> +                    m_enabled = true;
> +                    connectA11yBus(QString::fromLocal8Bit(addressEnv));
> +                },
> +                Qt::QueuedConnection);
> +        return;
> +    }
> +
>      // Start monitoring if "org.a11y.Bus" is registered as DBus service.
>      QDBusConnection c = QDBusConnection::sessionBus();
>      if (!c.isConnected()) {


Reply to: