Fix of a crash on startup when creating physical printer profiles from 2.2 configs (#5513, #5074)

The issue is that opening the wxMessageDialog in GUI_App::check_printer_presets  fires wxEVT_IDLE event (on Linux at least).
At that point it is already bound to our lambda which will in turn call post_init prematurely.
The solution is to move the Bind at the very end of the initialization. The post_init that it calls assumes that init has been finished anyway.
This commit is contained in:
Lukas Matena 2020-12-19 03:09:21 +01:00
parent 181642b85b
commit 1f5ac7d2f7

View File

@ -886,6 +886,23 @@ bool GUI_App::on_init_inner()
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
if (is_gcode_viewer()) {
mainframe->update_layout();
if (plater_ != nullptr)
// ensure the selected technology is ptFFF
plater_->set_printer_technology(ptFFF);
}
else
load_current_presets();
mainframe->Show(true);
obj_list()->set_min_height();
update_mode(); // update view mode after fix of the object_list size
#ifdef __APPLE__
other_instance_message_handler()->bring_instance_forward();
#endif //__APPLE__
Bind(wxEVT_IDLE, [this](wxIdleEvent& event)
{
@ -935,24 +952,6 @@ bool GUI_App::on_init_inner()
}
});
if (is_gcode_viewer()) {
mainframe->update_layout();
if (plater_ != nullptr)
// ensure the selected technology is ptFFF
plater_->set_printer_technology(ptFFF);
}
else
load_current_presets();
mainframe->Show(true);
obj_list()->set_min_height();
update_mode(); // update view mode after fix of the object_list size
#ifdef __APPLE__
other_instance_message_handler()->bring_instance_forward();
#endif //__APPLE__
m_initialized = true;
return true;
}