1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

SpaceAnalyzer: Fix the crash caused by using arrow keys

Previously, SpaceAnalyzer set focus on the selected BreadcrumbButton.
Using arrow keys triggered the keydown_event of the AbstractButton,
which later on caused a Function object to be deleted while it is still
being used.

This change sets the focus on TreeMapWidget and adds an event handler
to TreeMapWidget for keydown events.

Fixes #13254.
This commit is contained in:
Arif Orhun Uzun 2022-03-30 22:44:00 +03:00 committed by Andreas Kling
parent 51df97e799
commit eb34015748
3 changed files with 11 additions and 0 deletions

View file

@ -320,6 +320,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& treemapwidget = *mainwidget.find_descendant_of_type_named<SpaceAnalyzer::TreeMapWidget>("tree_map");
auto& statusbar = *mainwidget.find_descendant_of_type_named<GUI::Statusbar>("statusbar");
treemapwidget.set_focus(true);
auto& file_menu = window->add_menu("&File");
file_menu.add_action(GUI::Action::create("&Analyze", [&](auto&) {
analyze(tree, treemapwidget, statusbar);