From a8776a963442cbe501c2b49b4a76a264ce41cd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 29 Oct 2019 02:54:42 +0000 Subject: [PATCH] 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 13f10e36e4ac162f0b54fa57de24120e0e5a5453) --- src/core/window.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index f38f0fee2..ac8187978 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -4826,9 +4826,12 @@ set_workspace_state (MetaWindow *window, { 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) - 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 * times we're setting the workspace state is either during construction