x11/window: Mark restored workspace as “set”

When a window's workspace is not NULL, on_all_workspace should be FALSE.
Similarly, when on_all_workspace is TRUE, the window workspace should be
NULL.

This is an assumption in multiple places in the code, including when
setting the workspace state, the window is either added or removed from
all workspaces only if the window's workspace is NULL.

This rule is initially enforced at creation in _meta_window_shared_new()
when a initial workspace is set. However, when the initial workspace is
set from the session info, the initial workspace is not marked as “set”
which leads to an assertion failure when unmanaging windows, because the
window is not removed from all the workspaces.

When applying the session info to a window, mark the workspace as “set”.

https://gitlab.gnome.org/GNOME/mutter/issues/4

Closes: #4
This commit is contained in:
Olivier Fourdan 2018-01-29 16:58:46 +01:00
parent 5ea3a4ecbb
commit 97f142d1cc

View File

@ -461,6 +461,7 @@ meta_window_apply_session_info (MetaWindow *window,
MetaWorkspace *workspace = spaces->data; MetaWorkspace *workspace = spaces->data;
meta_window_change_workspace (window, workspace); meta_window_change_workspace (window, workspace);
window->initial_workspace_set = TRUE;
meta_topic (META_DEBUG_SM, meta_topic (META_DEBUG_SM,
"Restoring saved window %s to workspace %d\n", "Restoring saved window %s to workspace %d\n",