1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:37:34 +00:00

WindowServer: Catch more Window stealing misbehavior

Previously it was possible for a window to register as a parentless
blocking modal then add itself to a stealable parent's modal chain,
bypassing a mode misbehavior check in create_window()

Also relaxes reciprocity for blockers with the same parent. This
scenario is usually created by simultaneous MessageBoxes. It's not
an ideal UX to cascade these, but there's no need to crash over it.
This commit is contained in:
thankyouverycool 2023-05-13 05:10:54 -04:00 committed by Andreas Kling
parent c87c4f6d94
commit 44049f5ad5
3 changed files with 14 additions and 6 deletions

View file

@ -689,6 +689,8 @@ bool Window::is_active() const
Window* Window::blocking_modal_window()
{
auto maybe_blocker = WindowManager::the().for_each_window_in_modal_chain(*this, [&](auto& window) {
if (parent_window() == window.parent_window() && is_blocking())
return IterationDecision::Continue;
if (is_descendant_of(window))
return IterationDecision::Continue;
if (window.is_blocking() && this != &window)