From b553850e0a40c9d8948e6f28530f40ad60ed5359 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Sun, 3 Mar 2024 21:39:21 -0500 Subject: [PATCH] taskpanel: Delay setting panel position on screen change, so shell doesn't crash Setting it immediately seems to trigger an underlying bug that causes the shell to crash, see https://invent.kde.org/plasma/plasma-mobile/-/issues/321 I've cherry-picked this for Plasma 6 so we don't have this issue on stable, but I'm not sure if we should merge this into master or keep trying to identify the root cause. --- .../taskpanel/package/contents/ui/main.qml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/containments/taskpanel/package/contents/ui/main.qml b/containments/taskpanel/package/contents/ui/main.qml index fd27207a..b4fdda81 100644 --- a/containments/taskpanel/package/contents/ui/main.qml +++ b/containments/taskpanel/package/contents/ui/main.qml @@ -46,15 +46,24 @@ ContainmentItem { readonly property int intendedWindowLocation: inLandscape ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen - onIntendedWindowLocationChanged: { - root.panel.location = intendedWindowLocation; - } + onIntendedWindowLocationChanged: setPanelLocationTimer.restart() onIntendedWindowOffsetChanged: { if (root.panel) { root.panel.offset = intendedWindowOffset; } } + // HACK: the entire shell seems to crash sometimes if this is applied immediately after a display change (ex. screen rotation) + // see https://invent.kde.org/plasma/plasma-mobile/-/issues/321 + Timer { + id: setPanelLocationTimer + running: false + interval: 100 + onTriggered: { + root.panel.location = intendedWindowLocation; + } + } + // use a timer so we don't have to maximize for every single pixel // - improves performance if the shell is run in a window, and can be resized Timer {