1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

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.
This commit is contained in:
Arif Orhun Uzun 2022-03-07 00:01:29 +03:00 committed by Tim Flynn
parent 01bd3c5563
commit fe7d801dd9

View file

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