Accessibility: Do not use the session bus if not connected

When there is no DBus session, there will be no Linux accessibility,
since it relies on the presence of DBus.

Fixes: QTBUG-50189
Fixes: QTBUG-51940
Change-Id: I7503011b39ba2a806ddc12e89d0f7bd72a628b64
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Frederik Gladhorn 2019-05-15 10:48:49 +02:00
parent 1fd44915f9
commit 61d990da96
1 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,10 @@ DBusConnection::DBusConnection(QObject *parent)
{
// Start monitoring if "org.a11y.Bus" is registered as DBus service.
QDBusConnection c = QDBusConnection::sessionBus();
if (!c.isConnected()) {
return;
}
dbusWatcher = new QDBusServiceWatcher(A11Y_SERVICE, c, QDBusServiceWatcher::WatchForRegistration, this);
connect(dbusWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(serviceRegistered()));