From 211e938234085b30c976f117bba2f9899da34865 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 5 Mar 2020 19:49:18 +0100 Subject: [PATCH] LibGUI: Fix missing equality checks in Window::did_remove_widget() We should only detach from the cursor tracking widgets on unparenting if they were the same widget that's being unparented! Thanks to @agoose77 for spotting this! Fixes #1354. --- Libraries/LibGUI/Window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibGUI/Window.cpp b/Libraries/LibGUI/Window.cpp index 1424c58892..6c4e99aca4 100644 --- a/Libraries/LibGUI/Window.cpp +++ b/Libraries/LibGUI/Window.cpp @@ -695,9 +695,9 @@ void Window::did_remove_widget(Badge, const Widget& widget) m_focused_widget = nullptr; if (m_hovered_widget == &widget) m_hovered_widget = nullptr; - if (m_global_cursor_tracking_widget) + if (m_global_cursor_tracking_widget == &widget) m_global_cursor_tracking_widget = nullptr; - if (m_automatic_cursor_tracking_widget) + if (m_automatic_cursor_tracking_widget == &widget) m_automatic_cursor_tracking_widget = nullptr; }