[mutter] window: Assert we only set a NULL workspace when unmanaging



commit 13f10e36e4ac162f0b54fa57de24120e0e5a5453
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Oct 29 03:54:42 2019 +0100

    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

 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 8b8c8aad5..97f08fa24 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4835,9 +4835,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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]