WindowServer: Add missing minimize check to highlighted window callback

This patch adds a missing minimize check for highligted windows in
WindowStack::for_each_visible_window_of_type_from_front_to_back().
Minimized windows should not be treated as visible in this context.

Previously, iterating through each visible Window when recomputing
occlusions in the Compositor would cause a crash if a highlighted
Window is also minimized at the same time. As the WindowSwitcher
currently highligts Windows even when they are minimized, opening
it while any Window is minimized would cause WindowServer to crash.
This commit is contained in:
networkException 2021-07-08 20:59:36 +02:00 committed by Andreas Kling
parent 791a018c99
commit dac7b25b8a
Notes: sideshowbarker 2024-07-18 10:03:13 +09:00

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Jakob-Niklas See <git@nwex.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -122,7 +123,7 @@ template<typename Callback>
inline IterationDecision WindowStack::for_each_visible_window_of_type_from_front_to_back(WindowType type, Callback callback, bool ignore_highlight)
{
auto* highlight_window = this->highlight_window();
if (!ignore_highlight && highlight_window && highlight_window->type() == type && highlight_window->is_visible()) {
if (!ignore_highlight && highlight_window && highlight_window->type() == type && highlight_window->is_visible() && !highlight_window->is_minimized()) {
if (callback(*highlight_window) == IterationDecision::Break)
return IterationDecision::Break;
}