From 2a386c0b50d5a466fab754d89383630cc7e15c0d Mon Sep 17 00:00:00 2001 From: David Smith Date: Sun, 14 Aug 2022 23:23:59 +0200 Subject: [PATCH] LibGUI: Don't let widgets hide tooltips they didn't show Widget::handle_leave_event() hides the tooltip if one is shown. That's usually fine and hides the widget's tooltip, but it can happen that another widget managed to show a tooltip after the Leave event was triggered and before it's processed. Thus change handle_leave_event() to only hide the tooltip if it was show by the widget. Fixes the case where this could happen in the flame graph in Profiler when moving the mouse over the tooltip window itself #14852. --- Userland/Libraries/LibGUI/Widget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 8486f0fa6d..71efa5de5a 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -466,7 +466,8 @@ void Widget::handle_leave_event(Core::Event& event) { if (auto* window = this->window()) window->update_cursor({}); - Application::the()->hide_tooltip(); + if (Application::the()->tooltip_source_widget() == this) + Application::the()->hide_tooltip(); leave_event(event); }