From 910979cf73524a25d405fa7ae04a6545831abea1 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 26 Mar 2019 10:08:57 +0100 Subject: [PATCH] Fixed crash after change of a language + Updating of a mode after recreation --- src/slic3r/GUI/GUI_App.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index d68257a0a..d66e6f5ad 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -279,31 +280,50 @@ void GUI_App::set_label_clr_sys(const wxColour& clr) { void GUI_App::recreate_GUI() { + // Weird things happen as the Paint messages are floating around the windows being destructed. + // Avoid the Paint messages by hiding the main window. + // Also the application closes much faster without these unnecessary screen refreshes. + // In addition, there were some crashes due to the Paint events sent to already destructed windows. + mainframe->Show(false); + + const auto msg_name = _(L("Changing of an application language")) + dots; + wxProgressDialog dlg(msg_name, msg_name); + dlg.Pulse(); + // to make sure nobody accesses data from the soon-to-be-destroyed widgets: tabs_list.clear(); plater_ = nullptr; + dlg.Update(10, _(L("Recreating")) + dots); + MainFrame* topwindow = mainframe; mainframe = new MainFrame(); sidebar().obj_list()->init_objects(); // propagate model objects to object list if (topwindow) { SetTopWindow(mainframe); + + dlg.Update(30, _(L("Recreating")) + dots); topwindow->Destroy(); } + dlg.Update(80, _(L("Loading of a current presets")) + dots); + m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg())); load_current_presets(); mainframe->Show(true); - // On OSX the UI was not initialized correctly if the wizard was called - // before the UI was up and running. - CallAfter([]() { - // Run the config wizard, don't offer the "reset user profile" checkbox. - config_wizard_startup(true); - }); + dlg.Update(90, _(L("Loading of a mode view")) + dots); + + update_mode(); + + // #ys_FIXME_delete_after_testing Do we still need this ? +// CallAfter([]() { +// // Run the config wizard, don't offer the "reset user profile" checkbox. +// config_wizard_startup(true); +// }); } void GUI_App::system_info()