mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
fix a crash when changing layouts/old sessions
--when changing layouts/old sessions from the Latte Tasks Context menu, Latte was crashing very often. Add the switching code into a Timer to make its execution asynchronoushly
This commit is contained in:
parent
f30c9056b3
commit
badcaa5474
@ -107,11 +107,18 @@ void GlobalSettings::showWidgetsExplorer()
|
||||
|
||||
void GlobalSettings::enableAltSession(bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
m_corona->loadLatteLayout(QString(i18n("Alternative")));
|
||||
} else {
|
||||
m_corona->loadLatteLayout(QString(i18n("My Layout")));
|
||||
}
|
||||
//! this code must be called asynchronously because it is called
|
||||
//! also from qml (Tasks plasmoid). This change fixes a very important
|
||||
//! crash when switching sessions through the Tasks plasmoid Context menu
|
||||
//! Latte was unstable and was crashing very often during changing
|
||||
//! sessions
|
||||
QTimer::singleShot(200, [this, enabled]() {
|
||||
if (enabled) {
|
||||
m_corona->loadLatteLayout(QString(i18n("Alternative")));
|
||||
} else {
|
||||
m_corona->loadLatteLayout(QString(i18n("My Layout")));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool GlobalSettings::exposeAltSession() const
|
||||
|
@ -34,6 +34,8 @@ import "../code/activitiesTools.js" as ActivitiesTools
|
||||
PlasmaComponents.ContextMenu {
|
||||
id: menu
|
||||
|
||||
property bool changingLayout: false
|
||||
|
||||
property QtObject mpris2Source
|
||||
property QtObject backend
|
||||
|
||||
@ -264,13 +266,15 @@ PlasmaComponents.ContextMenu {
|
||||
|
||||
|
||||
Component.onDestruction: {
|
||||
windowsPreviewDlg.contextMenu = false;
|
||||
root.contextMenu = null;
|
||||
backend.ungrabMouse(visualParent);
|
||||
root.signalActionsBlockHiding(-1);
|
||||
//root.signalDraggingState(false);
|
||||
root.disableRestoreZoom = false;
|
||||
checkListHovered.startDuration(100);
|
||||
if (!changingLayout) {
|
||||
windowsPreviewDlg.contextMenu = false;
|
||||
root.contextMenu = null;
|
||||
backend.ungrabMouse(visualParent);
|
||||
root.signalActionsBlockHiding(-1);
|
||||
//root.signalDraggingState(false);
|
||||
root.disableRestoreZoom = false;
|
||||
checkListHovered.startDuration(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// Sub Items
|
||||
@ -800,6 +804,7 @@ PlasmaComponents.ContextMenu {
|
||||
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
|
||||
menu.changingLayout = true;
|
||||
root.disableRestoreZoom = false;
|
||||
root.clearZoom();
|
||||
if (latteDock)
|
||||
|
@ -495,6 +495,10 @@ Item {
|
||||
//this is the animation time needed in order for tasks to restore their zoom first
|
||||
interval: 7 * (root.durationTime * units.shortDuration)
|
||||
onTriggered: {
|
||||
if (root.contextMenu) {
|
||||
root.contextMenu.destroy();
|
||||
root.contextMenu = null;
|
||||
}
|
||||
if (root.altSessionAction)
|
||||
root.altSessionAction.trigger();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user