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.
This commit is contained in:
David Smith 2022-08-14 23:23:59 +02:00 committed by Andreas Kling
parent becec3578f
commit 2a386c0b50
Notes: sideshowbarker 2024-07-17 08:11:36 +09:00

View File

@ -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);
}