diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 7c78531ff..b13a5bcc9 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1348,21 +1348,6 @@ void GUI_App::shutdown() if (m_is_recreating_gui) return; m_is_closing = true; - stop_sync_user_preset(); - - if (m_device_manager) { - delete m_device_manager; - m_device_manager = nullptr; - } - - if (m_agent) { - //BBS avoid a crash on mac platform -#ifdef __WINDOWS__ - m_agent->start_discovery(false, false); -#endif - delete m_agent; - m_agent = nullptr; - } BOOST_LOG_TRIVIAL(info) << "GUI_App::shutdown exit"; } @@ -2289,6 +2274,27 @@ bool GUI_App::OnInit() } } +int GUI_App::OnExit() +{ + stop_sync_user_preset(); + + if (m_device_manager) { + delete m_device_manager; + m_device_manager = nullptr; + } + + if (m_agent) { + // BBS avoid a crash on mac platform +#ifdef __WINDOWS__ + m_agent->start_discovery(false, false); +#endif + delete m_agent; + m_agent = nullptr; + } + + return wxApp::OnExit(); +} + class wxBoostLog : public wxLog { void DoLogText(const wxString &msg) override { diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index bef103931..3eca6bc86 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -304,6 +304,7 @@ public: void check_filaments_in_blacklist(std::string tag_supplier, std::string tag_material, bool& in_blacklist, std::string& action, std::string& info); std::string get_local_models_path(); bool OnInit() override; + int OnExit() override; bool initialized() const { return m_initialized; } std::map test_url_state;