diff options
author | Arif Orhun Uzun <arif.orhun.uzun@gmail.com> | 2022-03-07 00:01:29 +0300 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-03-14 07:40:22 -0400 |
commit | fe7d801dd97c5e439a996906cda37da124d69e0f (patch) | |
tree | 37df70309b07248492f627ad9e0f8d19b928d067 /Userland/Applications | |
parent | 01bd3c55638ea7163368283b7c1ff0ca346e4a21 (diff) | |
download | serenity-fe7d801dd97c5e439a996906cda37da124d69e0f.zip |
SpaceAnalyzer: Fix the crash caused by double click
With #12480, Breadcrumbbar's on_focus_change() uses
on_click(). In SpaceAnalyzer, double clicking triggers the
TreeWidgetMap's on_path_change(), which triggers Breadcrumbbar's
on_focus_change(), which also triggers the TreeWidgetMap's
on_path_change() again. This resulted in use-after-free of
Breadcrumbbar, thus resulted in the crash. Not updating the
TreeWidgetMap's viewpoint recursively solves the issue.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp index df13cc346f..5409b358ff 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp @@ -341,6 +341,8 @@ void TreeMapWidget::set_tree(RefPtr<TreeMap> tree) void TreeMapWidget::set_viewpoint(size_t viewpoint) { + if (m_viewpoint == viewpoint) + return; if (viewpoint > m_path.size()) viewpoint = m_path.size(); m_viewpoint = viewpoint; |