Commit 931a5441 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

systemtray: Check if a service is already added before processing QDBusReply

Due to async nature of QDBusPendingReply, services could be already
registered by QDBusServiceWatcher when the pending reply takes a long
time to finish, so it's possible that QDBusServiceWatcher::serviceRegistered
signal is emitted before the pending reply emits QDBusPendingCallWatcher::finished,
which will make the same service added twice and crash plasmashell.

We need to check if a service is already added in m_sniServices before
processing registered items in QDBusReply.

BUG: 443961


(cherry picked from commit c0b8f687)
parent afff43ef
......@@ -101,7 +101,9 @@ void StatusNotifierItemHost::registerWatcher(const QString &service)
QDBusReply<QDBusVariant> reply = *watcher;
QStringList registeredItems = reply.value().variant().toStringList();
foreach (const QString &service, registeredItems) {
addSNIService(service);
if (!m_sniServices.contains(service)) { // due to async nature of this call, service may be already there
addSNIService(service);
}
}
});
......
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