diff --git a/src/context.cpp b/src/context.cpp --- a/src/context.cpp +++ b/src/context.cpp @@ -233,12 +233,7 @@ QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); - connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() { - if (!m_context) { - connectToDaemon(); - } - }); - + connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &Context::connectToDaemon); connectToDaemon(); } @@ -591,7 +586,9 @@ void Context::connectToDaemon() { - Q_ASSERT(m_context == nullptr); + if (m_context) { + return; + } // We require a glib event loop if (!QByteArray(QAbstractEventDispatcher::instance()->metaObject()->className()).contains("EventDispatcherGlib")) {