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
This commit is contained in:
Florian Müllner 2020-02-03 22:58:38 +01:00
parent 053bb5901a
commit c3d2f3f399

View File

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