1 |
commit: fe17673799c4432e586d0bf20b1a306371d2ea56 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 22 17:17:21 2021 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 23 14:59:14 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe176737 |
7 |
|
8 |
kde-plasma/plasma-workspace: systemtray: fix crash and race condition |
9 |
|
10 |
Upstream commits: |
11 |
931a5441746daf10d9476409f347263719ef6c63 |
12 |
a9fba8b5416dd3b130045ccac40e5412714563ea |
13 |
|
14 |
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=443961 |
15 |
Package-Manager: Portage-3.0.28, Repoman-3.0.3 |
16 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
17 |
|
18 |
...systemtray-check-if-service-already-added.patch | 41 ++++++++++++++++ |
19 |
...pace-5.23.3-systemtray-fix-race-condition.patch | 54 ++++++++++++++++++++++ |
20 |
.../plasma-workspace-5.23.3-r2.ebuild | 2 + |
21 |
3 files changed, 97 insertions(+) |
22 |
|
23 |
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 |
24 |
new file mode 100644 |
25 |
index 000000000000..6258b66f6e70 |
26 |
--- /dev/null |
27 |
+++ b/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-check-if-service-already-added.patch |
28 |
@@ -0,0 +1,41 @@ |
29 |
+From 931a5441746daf10d9476409f347263719ef6c63 Mon Sep 17 00:00:00 2001 |
30 |
+From: Fushan Wen <qydwhotmail@×××××.com> |
31 |
+Date: Mon, 1 Nov 2021 22:17:53 +0800 |
32 |
+Subject: [PATCH] systemtray: Check if a service is already added before |
33 |
+ processing QDBusReply |
34 |
+ |
35 |
+Due to async nature of QDBusPendingReply, services could be already |
36 |
+registered by QDBusServiceWatcher when the pending reply takes a long |
37 |
+time to finish, so it's possible that QDBusServiceWatcher::serviceRegistered |
38 |
+signal is emitted before the pending reply emits QDBusPendingCallWatcher::finished, |
39 |
+which will make the same service added twice and crash plasmashell. |
40 |
+ |
41 |
+We need to check if a service is already added in m_sniServices before |
42 |
+processing registered items in QDBusReply. |
43 |
+ |
44 |
+BUG: 443961 |
45 |
+ |
46 |
+ |
47 |
+(cherry picked from commit c0b8f6871e75bbc268165844ad5780f13a5f88ac) |
48 |
+--- |
49 |
+ applets/systemtray/statusnotifieritemhost.cpp | 4 +++- |
50 |
+ 1 file changed, 3 insertions(+), 1 deletion(-) |
51 |
+ |
52 |
+diff --git a/applets/systemtray/statusnotifieritemhost.cpp b/applets/systemtray/statusnotifieritemhost.cpp |
53 |
+index c17eedd6c..4108b2b82 100644 |
54 |
+--- a/applets/systemtray/statusnotifieritemhost.cpp |
55 |
++++ b/applets/systemtray/statusnotifieritemhost.cpp |
56 |
+@@ -101,7 +101,9 @@ void StatusNotifierItemHost::registerWatcher(const QString &service) |
57 |
+ QDBusReply<QDBusVariant> reply = *watcher; |
58 |
+ QStringList registeredItems = reply.value().variant().toStringList(); |
59 |
+ foreach (const QString &service, registeredItems) { |
60 |
+- addSNIService(service); |
61 |
++ if (!m_sniServices.contains(service)) { // due to async nature of this call, service may be already there |
62 |
++ addSNIService(service); |
63 |
++ } |
64 |
+ } |
65 |
+ }); |
66 |
+ |
67 |
+-- |
68 |
+GitLab |
69 |
+ |
70 |
|
71 |
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 |
72 |
new file mode 100644 |
73 |
index 000000000000..bbe9a152c608 |
74 |
--- /dev/null |
75 |
+++ b/kde-plasma/plasma-workspace/files/plasma-workspace-5.23.3-systemtray-fix-race-condition.patch |
76 |
@@ -0,0 +1,54 @@ |
77 |
+From a9fba8b5416dd3b130045ccac40e5412714563ea Mon Sep 17 00:00:00 2001 |
78 |
+From: Fushan Wen <qydwhotmail@×××××.com> |
79 |
+Date: Sat, 20 Nov 2021 21:04:06 +0800 |
80 |
+Subject: [PATCH] systemtray: Connect to StatusNotifierWatcher before |
81 |
+ initializing QDBusPendingReply |
82 |
+ |
83 |
+This fixes a race condition. |
84 |
+ |
85 |
+ |
86 |
+(cherry picked from commit 644588739e617cfde8ee097dff4a72cc08c421aa) |
87 |
+--- |
88 |
+ applets/systemtray/statusnotifieritemhost.cpp | 19 +++++++++---------- |
89 |
+ 1 file changed, 9 insertions(+), 10 deletions(-) |
90 |
+ |
91 |
+diff --git a/applets/systemtray/statusnotifieritemhost.cpp b/applets/systemtray/statusnotifieritemhost.cpp |
92 |
+index 4108b2b82..117c29f17 100644 |
93 |
+--- a/applets/systemtray/statusnotifieritemhost.cpp |
94 |
++++ b/applets/systemtray/statusnotifieritemhost.cpp |
95 |
+@@ -93,6 +93,15 @@ void StatusNotifierItemHost::registerWatcher(const QString &service) |
96 |
+ m_statusNotifierWatcher->path(), |
97 |
+ m_statusNotifierWatcher->connection()); |
98 |
+ |
99 |
++ connect(m_statusNotifierWatcher, |
100 |
++ &OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemRegistered, |
101 |
++ this, |
102 |
++ &StatusNotifierItemHost::serviceRegistered); |
103 |
++ connect(m_statusNotifierWatcher, |
104 |
++ &OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemUnregistered, |
105 |
++ this, |
106 |
++ &StatusNotifierItemHost::serviceUnregistered); |
107 |
++ |
108 |
+ QDBusPendingReply<QDBusVariant> pendingItems = propetriesIface.Get(m_statusNotifierWatcher->interface(), "RegisteredStatusNotifierItems"); |
109 |
+ |
110 |
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingItems, this); |
111 |
+@@ -106,16 +115,6 @@ void StatusNotifierItemHost::registerWatcher(const QString &service) |
112 |
+ } |
113 |
+ } |
114 |
+ }); |
115 |
+- |
116 |
+- connect(m_statusNotifierWatcher, |
117 |
+- &OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemRegistered, |
118 |
+- this, |
119 |
+- &StatusNotifierItemHost::serviceRegistered); |
120 |
+- connect(m_statusNotifierWatcher, |
121 |
+- &OrgKdeStatusNotifierWatcherInterface::StatusNotifierItemUnregistered, |
122 |
+- this, |
123 |
+- &StatusNotifierItemHost::serviceUnregistered); |
124 |
+- |
125 |
+ } else { |
126 |
+ delete m_statusNotifierWatcher; |
127 |
+ m_statusNotifierWatcher = nullptr; |
128 |
+-- |
129 |
+GitLab |
130 |
+ |
131 |
|
132 |
diff --git a/kde-plasma/plasma-workspace/plasma-workspace-5.23.3-r2.ebuild b/kde-plasma/plasma-workspace/plasma-workspace-5.23.3-r2.ebuild |
133 |
index 5bc9e1a28269..9d9161b72295 100644 |
134 |
--- a/kde-plasma/plasma-workspace/plasma-workspace-5.23.3-r2.ebuild |
135 |
+++ b/kde-plasma/plasma-workspace/plasma-workspace-5.23.3-r2.ebuild |
136 |
@@ -151,6 +151,8 @@ PATCHES=( |
137 |
"${FILESDIR}/${PN}-5.21.5-split-libkworkspace.patch" # downstream |
138 |
"${FILESDIR}/${PN}-5.22.5-krunner-cwd-at-home.patch" # TODO upstream: KDE-bug 432975, bug 767478 |
139 |
"${FILESDIR}/${P}-baloosearchrunner-emit-DBus-error-when-disabled.patch" # KDE-bug 445342 |
140 |
+ "${FILESDIR}/${P}-systemtray-check-if-service-already-added.patch" # KDE-bug 443961 |
141 |
+ "${FILESDIR}/${P}-systemtray-fix-race-condition.patch" |
142 |
) |
143 |
|
144 |
src_prepare() { |