[mutter] window: Guard minimize()



commit 7ff1c04c8fc6148d5a940601ffa2ea98f04f6548
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 30 13:56:21 2022 +0200

    window: Guard minimize()
    
    Not all windows can be minimized: X11 clients can disable the
    functionality, and so do we for windows that aren't shown in
    the alt-tab popup or the shell overview, so there would be no
    way of getting them back.
    
    While we make sure that we respect that ourselves (keybinding,
    window menu, etc.), we don't guard meta_window_minimize(), so
    clients or extensions can still minimize a window that isn't
    supposed to be minimized.
    
    That can lead to all kinds of issues, from the hidden window
    being lost (as far as users are concerned) to a crash when
    the minimzed window has a transient parent.
    
    Just add an explicit check to make sure the unexpected doesn't
    happen after all, and print a warning if it does.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2491>

 src/core/window.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/core/window.c b/src/core/window.c
index 32788d813f..258dc1f9af 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2463,6 +2463,13 @@ meta_window_minimize (MetaWindow  *window)
 {
   g_return_if_fail (!window->override_redirect);
 
+  if (!window->has_minimize_func)
+    {
+      g_warning ("Window %s cannot be minimized, but something tried "
+                 "anyways. Not having it!", window->desc);
+      return;
+    }
+
   if (!window->minimized)
     {
       window->minimized = TRUE;


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