From dac7b25b8aa1cb2530d39e0b6a36c2af87ff68f0 Mon Sep 17 00:00:00 2001 From: networkException Date: Thu, 8 Jul 2021 20:59:36 +0200 Subject: [PATCH] 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. --- Userland/Services/WindowServer/WindowStack.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Services/WindowServer/WindowStack.h b/Userland/Services/WindowServer/WindowStack.h index d396df04595..a1fd6dddae5 100644 --- a/Userland/Services/WindowServer/WindowStack.h +++ b/Userland/Services/WindowServer/WindowStack.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2021, Andreas Kling + * Copyright (c) 2021, Jakob-Niklas See * * SPDX-License-Identifier: BSD-2-Clause */ @@ -122,7 +123,7 @@ template 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; }