Commit a9fba8b5 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

systemtray: Connect to StatusNotifierWatcher before initializing QDBusPendingReply

This fixes a race condition.


(cherry picked from commit 64458873)
parent 931a5441
......@@ -93,6 +93,15 @@ void StatusNotifierItemHost::registerWatcher(const QString &service)
m_statusNotifierWatcher->path(),
m_statusNotifierWatcher->connection());
connect(m_statusNotifierWatcher,
&OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemRegistered,
this,
&StatusNotifierItemHost::serviceRegistered);
connect(m_statusNotifierWatcher,
&OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemUnregistered,
this,
&StatusNotifierItemHost::serviceUnregistered);
QDBusPendingReply<QDBusVariant> pendingItems = propetriesIface.Get(m_statusNotifierWatcher->interface(), "RegisteredStatusNotifierItems");
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingItems, this);
......@@ -106,16 +115,6 @@ void StatusNotifierItemHost::registerWatcher(const QString &service)
}
}
});
connect(m_statusNotifierWatcher,
&OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemRegistered,
this,
&StatusNotifierItemHost::serviceRegistered);
connect(m_statusNotifierWatcher,
&OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemUnregistered,
this,
&StatusNotifierItemHost::serviceUnregistered);
} else {
delete m_statusNotifierWatcher;
m_statusNotifierWatcher = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment