浏览代码

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.
Arif Orhun Uzun 3 年之前
父节点
当前提交
fe7d801dd9
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp

+ 2 - 0
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;