[mutter] workspace: Downgrade abort() to a warning when getting index



commit 4469042e2a16333cf7dada0f750c388eb0184d48
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Dec 4 23:39:58 2021 +0100

    workspace: Downgrade abort() to a warning when getting index
    
    Instead of crashing on invalid input, just log a warning and return -1.
    This will hopefully result in less abort():y behavior with missbehaving
    Javascript code.
    
    Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4203
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2134>

 src/core/workspace.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 76ba87b5ac..3bd517fca6 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -717,9 +717,7 @@ meta_workspace_index (MetaWorkspace *workspace)
   int ret;
 
   ret = g_list_index (workspace->manager->workspaces, workspace);
-
-  if (ret < 0)
-    meta_bug ("Workspace does not exist to index!");
+  g_return_val_if_fail (ret >= 0, -1);
 
   return ret;
 }


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