From aa0aa89a1e665b92835828f28f0f54104bde1471 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 d7d3e1b59..d5c92102b 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -1288,7 +1288,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