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.
This commit is contained in:
Devin Lin 2024-03-03 21:39:21 -05:00
parent 7cb6ebaae1
commit b553850e0a

View file

@ -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 {