Skip to content

Commit

Permalink
Hotfix tool mapping screen after refactoring FSM.
Browse files Browse the repository at this point in the history
As a special exception we do not close PrintPreview screen when the LoadUnload dialog
is requested. It would destroy the ToolsMappingBody while one of its methods is still
executing, leading to calling refresh_physical_tool_filament_labels() which in turn
jumped to undefined memory.
  • Loading branch information
danopernis authored and lukash committed Mar 28, 2024
1 parent 83513e4 commit c6be896
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/gui/dialogs/DialogHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,16 @@ void DialogHandler::Loop() {
change(new_top->fsm_type, new_top->data);
}
} else {
close(old_top->fsm_type);
Screens::Access()->Loop();
if (new_top->fsm_type == ClientFSM::Load_unload && old_top->fsm_type == ClientFSM::PrintPreview) {
// TODO Remove this shitcode/prasohack as soon as possible.
// As a special exception we do not close PrintPreview screen when the LoadUnload dialog
// is requested. It would destroy the ToolsMappingBody while one of its methods is still
// executing, leading to calling refresh_physical_tool_filament_labels() which in turn
// jumped to undefined memory.
} else {
close(old_top->fsm_type);
Screens::Access()->Loop();
}
open(new_top->fsm_type, new_top->data);
Screens::Access()->Loop();
change(new_top->fsm_type, new_top->data);
Expand Down

0 comments on commit c6be896

Please sign in to comment.