summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Smith <davsm2@yahoo.se>2022-07-24 22:46:03 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-24 23:19:09 +0100
commitc2a1817c704a2e7109c823c8b847731e12f647e9 (patch)
tree152543417f5d34010b2dea259580c196edf2bb28
parentf52e468cd6c996952c11aa198ce3ace43c7f5d2b (diff)
downloadserenity-c2a1817c704a2e7109c823c8b847731e12f647e9.zip
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.
-rw-r--r--Userland/DevTools/Profiler/FlameGraphView.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/DevTools/Profiler/FlameGraphView.cpp b/Userland/DevTools/Profiler/FlameGraphView.cpp
index 351b9c9b15..df2e84b936 100644
--- a/Userland/DevTools/Profiler/FlameGraphView.cpp
+++ b/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;