shell/app: Don't move all workspace windows to their startup workspace

Windows from some applications, such as guake, are created as showing on
all workspaces. When these windows are put on the workspaces via
set_workspace_state() during construction, the first time the window is
added to a workspace in the loop triggers the shell app tracker which
then tries to move the window to its startup workspace. This makes the
window unsticky which triggers another set_workspace_state() which
tries to remove the window from all workspaces, but currently it is only
on the first one and then adds it to the startup workspace. Once that is
finished, the first set_workspace_state() continues adding the window
to the remaining workspaces, despite the window now no longer having
on_all_workspaces set to true.

When the window is now unmanaged, the window according to its internal
state is only found on the startup workspace, so it will only be removed
from that. This causes the assertion to fail that checks that the window
is no longer present on any workspace after this.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4720

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2014>
This commit is contained in:
Sebastian Keller 2021-10-30 13:21:17 +02:00
parent ff4ff66498
commit bc32a52108

View File

@ -1126,7 +1126,7 @@ _shell_app_add_window (ShellApp *app,
app->running_state->interesting_windows++;
shell_app_sync_running_state (app);
if (app->started_on_workspace >= 0)
if (app->started_on_workspace >= 0 && !meta_window_is_on_all_workspaces (window))
meta_window_change_workspace_by_index (window, app->started_on_workspace, FALSE);
app->started_on_workspace = -1;