1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

Profiler: Fix use after free in FlameGraphView

Layout cleared the list of bars in the flame graph, but didn't clear the
reference m_hovered_bar. This could cause a crash in mousedown_event()
when clicking twice: the first click caused layout, the second used
the old reference.
This commit is contained in:
David Smith 2022-07-24 22:46:03 +02:00 committed by Linus Groh
parent f52e468cd6
commit c2a1817c70

View file

@ -165,6 +165,7 @@ String FlameGraphView::bar_label(StackBar const& bar) const
void FlameGraphView::layout_bars()
{
m_bars.clear();
m_hovered_bar = nullptr;
// Explicit copy here so the layout can mutate
Vector<GUI::ModelIndex> selected = m_selected_indexes;