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.
This commit is contained in:
Andreas Kling 2020-03-05 19:49:18 +01:00
parent c982bfee7e
commit 211e938234
Notes: sideshowbarker 2024-07-19 08:53:15 +09:00

View file

@ -695,9 +695,9 @@ void Window::did_remove_widget(Badge<Widget>, 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;
}