Browse Source

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.
David Smith 3 years ago
parent
commit
c2a1817c70
1 changed files with 1 additions and 0 deletions
  1. 1 0
      Userland/DevTools/Profiler/FlameGraphView.cpp

+ 1 - 0
Userland/DevTools/Profiler/FlameGraphView.cpp

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