summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/themes/genericunix/qgenericunixthemes.cpp')
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index eeb03eb958..5eac0a3584 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -112,9 +112,11 @@ static bool isDBusTrayAvailable() {
#ifndef QT_NO_DBUS
static bool checkDBusGlobalMenuAvailable()
{
- QDBusConnection connection = QDBusConnection::sessionBus();
- QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar");
- return connection.interface()->isServiceRegistered(registrarService);
+ const QDBusConnection connection = QDBusConnection::sessionBus();
+ static const QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar");
+ if (const auto iface = connection.interface())
+ return iface->isServiceRegistered(registrarService);
+ return false;
}
static bool isDBusGlobalMenuAvailable()