summaryrefslogtreecommitdiff
path: root/kde-plasma/plasma-workspace/files/plasma-workspace-5.20.5-fix-crash-on-screen-changes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'kde-plasma/plasma-workspace/files/plasma-workspace-5.20.5-fix-crash-on-screen-changes.patch')
-rw-r--r--kde-plasma/plasma-workspace/files/plasma-workspace-5.20.5-fix-crash-on-screen-changes.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/kde-plasma/plasma-workspace/files/plasma-workspace-5.20.5-fix-crash-on-screen-changes.patch b/kde-plasma/plasma-workspace/files/plasma-workspace-5.20.5-fix-crash-on-screen-changes.patch
new file mode 100644
index 000000000000..58f3a50c4911
--- /dev/null
+++ b/kde-plasma/plasma-workspace/files/plasma-workspace-5.20.5-fix-crash-on-screen-changes.patch
@@ -0,0 +1,63 @@
+From fa2bafea8f0cd9fac0864ac23f23c955d5f15b73 Mon Sep 17 00:00:00 2001
+From: David Edmundson <kde@davidedmundson.co.uk>
+Date: Tue, 5 Jan 2021 23:57:19 +0000
+Subject: [PATCH] [panel] Fix crash on screen changes
+
+There is an error handling path when we fetch the relevant config()
+
+```
+KConfigGroup PanelView::panelConfig(...
+{
+ if (!containment || !screen) {
+ return KConfigGroup();
+ }
+```
+
+which we indiscrimiately call parent() on.
+
+This patch guards that case, which is presumably screen being
+temporarily null.
+
+This code is also Plasma 5.8 compatibility fallback, so arguably we
+could get rid of it.
+
+BUG: 425711
+---
+ shell/panelview.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/shell/panelview.cpp b/shell/panelview.cpp
+index 28e86d2d3..991364e97 100644
+--- a/shell/panelview.cpp
++++ b/shell/panelview.cpp
+@@ -561,7 +561,8 @@ void PanelView::resizePanel()
+
+ void PanelView::restore()
+ {
+- if (!containment()) {
++ KConfigGroup panelConfig = config();
++ if (!panelConfig.isValid()) {
+ return;
+ }
+
+@@ -572,7 +573,7 @@ void PanelView::restore()
+ //but if fails read it from the resolution dependent one as
+ //the place for this config key is changed in Plasma 5.9
+ //Do NOT use readConfigValueWithFallBack
+- setAlignment((Qt::Alignment)config().parent().readEntry<int>("alignment", config().readEntry<int>("alignment", m_alignment)));
++ setAlignment((Qt::Alignment)panelConfig.parent().readEntry<int>("alignment", panelConfig.readEntry<int>("alignment", m_alignment)));
+
+ // All the other values are read from screen independent values,
+ // but fallback on the screen independent section, as is the only place
+@@ -599,7 +600,7 @@ void PanelView::restore()
+ //but if fails read it from the resolution dependent one as
+ //the place for this config key is changed in Plasma 5.9
+ //Do NOT use readConfigValueWithFallBack
+- setVisibilityMode((VisibilityMode)config().parent().readEntry<int>("panelVisibility", config().readEntry<int>("panelVisibility", (int)NormalPanel)));
++ setVisibilityMode((VisibilityMode)panelConfig.parent().readEntry<int>("panelVisibility", panelConfig.readEntry<int>("panelVisibility", (int)NormalPanel)));
+ m_initCompleted = true;
+ resizePanel();
+ positionPanel();
+--
+GitLab
+