diff options
author | bubnikv <bubnikv@gmail.com> | 2020-03-07 14:24:40 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2020-03-07 14:24:53 +0300 |
commit | d4ac4df21cf03827e63c7a088c2036a36d1a663d (patch) | |
tree | ffcaa9cbee39494562d74881cdc39ec212d16931 /src/slic3r/GUI/MainFrame.cpp | |
parent | fb10e2777823f27af93bed162e9e8602a8aa6ab0 (diff) |
Fixed crash on switching the application language.version_2.2.0-rc2
This crash was caused by the RemovableDriveManager and 3DConnexion
detection services not being stopped correctly.
The fix executes all the tasks of the MainFrame at the language switch,
that are normally performed on application shut down.
Diffstat (limited to 'src/slic3r/GUI/MainFrame.cpp')
-rw-r--r-- | src/slic3r/GUI/MainFrame.cpp | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 0d1623178..defd0b53a 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -109,38 +109,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S event.Veto(); return; } - - if (m_plater) - m_plater->stop_jobs(); - - // 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. - this->Show(false); - - // Stop the background thread (Windows and Linux). - // Disconnect from a 3DConnextion driver (OSX). - m_plater->get_mouse3d_controller().shutdown(); - // Store the device parameter database back to appconfig. - m_plater->get_mouse3d_controller().save_config(*wxGetApp().app_config); - - // Stop the background thread of the removable drive manager, so that no new updates will be sent to the Plater. - wxGetApp().removable_drive_manager()->shutdown(); - - // Save the slic3r.ini.Usually the ini file is saved from "on idle" callback, - // but in rare cases it may not have been called yet. - wxGetApp().app_config->save(); -// if (m_plater) -// m_plater->print = undef; - _3DScene::remove_all_canvases(); -// Slic3r::GUI::deregister_on_request_update_callback(); - - // set to null tabs and a plater - // to avoid any manipulations with them from App->wxEVT_IDLE after of the mainframe closing - wxGetApp().tabs_list.clear(); - wxGetApp().plater_ = nullptr; - + this->shutdown(); // propagate event event.Skip(); }); @@ -159,6 +128,41 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S m_plater->show_action_buttons(true); } +// Called when closing the application and when switching the application language. +void MainFrame::shutdown() +{ + if (m_plater) + m_plater->stop_jobs(); + + // 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. + this->Show(false); + + // Stop the background thread (Windows and Linux). + // Disconnect from a 3DConnextion driver (OSX). + m_plater->get_mouse3d_controller().shutdown(); + // Store the device parameter database back to appconfig. + m_plater->get_mouse3d_controller().save_config(*wxGetApp().app_config); + + // Stop the background thread of the removable drive manager, so that no new updates will be sent to the Plater. + wxGetApp().removable_drive_manager()->shutdown(); + + // Save the slic3r.ini.Usually the ini file is saved from "on idle" callback, + // but in rare cases it may not have been called yet. + wxGetApp().app_config->save(); +// if (m_plater) +// m_plater->print = undef; + _3DScene::remove_all_canvases(); +// Slic3r::GUI::deregister_on_request_update_callback(); + + // set to null tabs and a plater + // to avoid any manipulations with them from App->wxEVT_IDLE after of the mainframe closing + wxGetApp().tabs_list.clear(); + wxGetApp().plater_ = nullptr; +} + void MainFrame::update_title() { wxString title = wxEmptyString; |