From 458750aa06d769bf7c6392c8836f852fadeabaf4 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 27 May 2017 19:15:49 +0300 Subject: [PATCH] fix #496,crash when changing to Alternative Session -- a rare crash when changing to Alternative Session through Tasks context menu --- plasmoid/package/contents/ui/ContextMenu.qml | 10 +++++++++- plasmoid/package/contents/ui/main.qml | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index 01688c144..86ebd1ab5 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -862,7 +862,15 @@ PlasmaComponents.ContextMenu { checked = root.altSessionAction.checked; } - onClicked: root.altSessionAction.trigger(); + onClicked: { + //fix a crash that when going to Alternative Session through Context Menu, + //animations are played during the destruction and because of that Latte.IconItem is crashing + root.disableRestoreZoom = false; + root.clearZoom(); + if (latteDock) + latteDock.clearZoom(); + changeToAlternativeSessionTimer.start(); + } } PlasmaComponents.MenuItem { diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index f3cb1eb58..dfef6ad1d 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -452,6 +452,20 @@ Item { onTriggered: windowsPreviewDlg.visible = true; } + //! Timer to fix a crash that when going to Alternative Session through Context Menu, + //! animations are played during the destruction and because of that Latte.IconItem is crashing. + //! the timer makes sure that the animations will have ended and then change to alternative + //! session + Timer { + id: changeToAlternativeSessionTimer + //this is the animation time needed in order for tasks to restore their zoom first + interval: 7 * (root.durationTime * units.shortDuration) + onTriggered: { + if (root.altSessionAction) + root.altSessionAction.trigger(); + } + } + /////Window Previews///////// TaskManager.TasksModel {