diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2021-11-22 18:17:21 +0100 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2021-11-23 15:59:14 +0100 |
commit | fe17673799c4432e586d0bf20b1a306371d2ea56 (patch) | |
tree | 5940af9aeeeb88f25a7c80a6c2ae7bfa33f923e3 /kde-plasma/plasma-workspace/files | |
parent | kde-plasma/plasma-workspace: baloosearchruner: Emit DBus error (diff) | |
download | gentoo-fe17673799c4432e586d0bf20b1a306371d2ea56.tar.gz gentoo-fe17673799c4432e586d0bf20b1a306371d2ea56.tar.bz2 gentoo-fe17673799c4432e586d0bf20b1a306371d2ea56.zip |
kde-plasma/plasma-workspace: systemtray: fix crash and race condition
Upstream commits:
931a5441746daf10d9476409f347263719ef6c63
a9fba8b5416dd3b130045ccac40e5412714563ea
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=443961
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-plasma/plasma-workspace/files')
2 files changed, 95 insertions, 0 deletions
diff --git a/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-check-if-service-already-added.patch b/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-check-if-service-already-added.patch new file mode 100644 index 000000000000..6258b66f6e70 --- /dev/null +++ b/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-check-if-service-already-added.patch @@ -0,0 +1,41 @@ +From 931a5441746daf10d9476409f347263719ef6c63 Mon Sep 17 00:00:00 2001 +From: Fushan Wen <qydwhotmail@gmail.com> +Date: Mon, 1 Nov 2021 22:17:53 +0800 +Subject: [PATCH] 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 c0b8f6871e75bbc268165844ad5780f13a5f88ac) +--- + applets/systemtray/statusnotifieritemhost.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/applets/systemtray/statusnotifieritemhost.cpp b/applets/systemtray/statusnotifieritemhost.cpp +index c17eedd6c..4108b2b82 100644 +--- a/applets/systemtray/statusnotifieritemhost.cpp ++++ b/applets/systemtray/statusnotifieritemhost.cpp +@@ -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); ++ } + } + }); + +-- +GitLab + diff --git a/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-fix-race-condition.patch b/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-fix-race-condition.patch new file mode 100644 index 000000000000..bbe9a152c608 --- /dev/null +++ b/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-fix-race-condition.patch @@ -0,0 +1,54 @@ +From a9fba8b5416dd3b130045ccac40e5412714563ea Mon Sep 17 00:00:00 2001 +From: Fushan Wen <qydwhotmail@gmail.com> +Date: Sat, 20 Nov 2021 21:04:06 +0800 +Subject: [PATCH] systemtray: Connect to StatusNotifierWatcher before + initializing QDBusPendingReply + +This fixes a race condition. + + +(cherry picked from commit 644588739e617cfde8ee097dff4a72cc08c421aa) +--- + applets/systemtray/statusnotifieritemhost.cpp | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/applets/systemtray/statusnotifieritemhost.cpp b/applets/systemtray/statusnotifieritemhost.cpp +index 4108b2b82..117c29f17 100644 +--- a/applets/systemtray/statusnotifieritemhost.cpp ++++ b/applets/systemtray/statusnotifieritemhost.cpp +@@ -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; +-- +GitLab + |