From 7ff1c04c8fc6148d5a940601ffa2ea98f04f6548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 30 Jun 2022 13:56:21 +0200 Subject: [PATCH] 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: --- src/core/window.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/window.c b/src/core/window.c index 32788d813..258dc1f9a 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;