[mutter/gnome-3-34] window: Assert we only set a NULL workspace when unmanaging



commit a8776a963442cbe501c2b49b4a76a264ce41cd43
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Oct 29 02:54:42 2019 +0000

    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


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