summaryrefslogtreecommitdiff
path: root/kde-plasma/plasma-workspace/files/plasma-workspace-5.19.5-guard-against-no-virtual-desktops.patch
diff options
context:
space:
mode:
Diffstat (limited to 'kde-plasma/plasma-workspace/files/plasma-workspace-5.19.5-guard-against-no-virtual-desktops.patch')
-rw-r--r--kde-plasma/plasma-workspace/files/plasma-workspace-5.19.5-guard-against-no-virtual-desktops.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/kde-plasma/plasma-workspace/files/plasma-workspace-5.19.5-guard-against-no-virtual-desktops.patch b/kde-plasma/plasma-workspace/files/plasma-workspace-5.19.5-guard-against-no-virtual-desktops.patch
new file mode 100644
index 000000000000..21e335315907
--- /dev/null
+++ b/kde-plasma/plasma-workspace/files/plasma-workspace-5.19.5-guard-against-no-virtual-desktops.patch
@@ -0,0 +1,46 @@
+From 5cb38daedbfa5ef26a47d82d197c96230a004b0f Mon Sep 17 00:00:00 2001
+From: David Edmundson <kde@davidedmundson.co.uk>
+Date: Wed, 30 Sep 2020 08:56:16 +0000
+Subject: [PATCH] [containmentactions] Guard against having no virtual desktops
+
+It can apparently happen that virtual desktops is empty at a given point
+in time. Potentially due to other bugs on the system.
+
+Calls to desktopIds.at(N) will fail.
+
+BUG: 427106
+
+
+(cherry picked from commit 2441c82a2a92535ccc0a9643715427eb362c98e8)
+---
+ containmentactions/switchdesktop/desktop.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/containmentactions/switchdesktop/desktop.cpp b/containmentactions/switchdesktop/desktop.cpp
+index 809543a49..dda78c584 100644
+--- a/containmentactions/switchdesktop/desktop.cpp
++++ b/containmentactions/switchdesktop/desktop.cpp
+@@ -85,6 +85,10 @@ void SwitchDesktop::switchTo()
+ void SwitchDesktop::performNextAction()
+ {
+ const QVariantList &desktopIds = m_virtualDesktopInfo->desktopIds();
++ if (desktopIds.isEmpty()) {
++ return;
++ }
++
+ const QVariant &currentDesktop = m_virtualDesktopInfo->currentDesktop();
+ const int currentDesktopIndex = desktopIds.indexOf(currentDesktop);
+
+@@ -100,6 +104,9 @@ void SwitchDesktop::performNextAction()
+ void SwitchDesktop::performPreviousAction()
+ {
+ const QVariantList &desktopIds = m_virtualDesktopInfo->desktopIds();
++ if (desktopIds.isEmpty()) {
++ return;
++ }
+ const QVariant &currentDesktop = m_virtualDesktopInfo->currentDesktop();
+ const int currentDesktopIndex = desktopIds.indexOf(currentDesktop);
+
+--
+GitLab
+