window: Assert we only set a NULL workspace when unmanaging

There might be cases in which a window might be marked as both not in all
workspaces and with NULL workspace.

So to avoid this to happen, let's just assert early instead of doing this at
later point where the context might not be clear.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/885

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895


(cherry picked from commit 13f10e36e4)
This commit is contained in:
Marco Trevisan (Treviño) 2019-10-29 02:54:42 +00:00 committed by Marco Trevisan
parent 4b238c10f4
commit a8776a9634

View File

@ -4826,9 +4826,12 @@ set_workspace_state (MetaWindow *window,
{ {
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager; MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
/* If we're on all workspaces, then our new workspace must be NULL. */ /* If we're on all workspaces, then our new workspace must be NULL,
* otherwise it must be set, unless we're unmanaging. */
if (on_all_workspaces) if (on_all_workspaces)
g_assert (workspace == NULL); g_assert_null (workspace);
else
g_assert_true (window->unmanaging || workspace != NULL);
/* If this is an override-redirect window, ensure that the only /* If this is an override-redirect window, ensure that the only
* times we're setting the workspace state is either during construction * times we're setting the workspace state is either during construction