Przeglądaj źródła

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 lat temu
rodzic
commit
fe7d801dd9

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