From c3d2f3f39976e1aab3481ecc6e505f114d3babd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 3 Feb 2020 22:58:38 +0100 Subject: [PATCH] window: Ignore requests to be placed on non-existent workspaces When an X11 window requests an initial workspace, we currently trust it that the workspace actually exists. However dynamic workspaces make this easy to get wrong for applications: They make it likely for the number of workspaces to change between application starts, and if the app blindly applies its saved state on startup, it will trigger an assertion. Make sure that we pass valid parameters to set_workspace_state(), and simply let the workspace assignment fall through to the default handling otherwise. https://gitlab.gnome.org/GNOME/mutter/issues/1029 --- src/core/window.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/window.c b/src/core/window.c index ac8187978..a64ccb011 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1289,7 +1289,10 @@ _meta_window_shared_new (MetaDisplay *display, window->initial_workspace); } - set_workspace_state (window, on_all_workspaces, workspace); + /* Ignore when a window requests to be placed on a non-existent workspace + */ + if (on_all_workspaces || workspace != NULL) + set_workspace_state (window, on_all_workspaces, workspace); } /* override-redirect windows are subtly different from other windows