FIX: move shutdown wait to OnExit

Change-Id: I70d9a2bb686525ae5273aa9d63e25691da4ab65c
Jira: STUDIO-2884
This commit is contained in:
chunmao.guo 2023-11-27 14:23:12 +08:00 committed by Lane.Wei
parent ba8458aa0a
commit 1c26ebe03c
2 changed files with 22 additions and 15 deletions

View File

@ -1348,21 +1348,6 @@ void GUI_App::shutdown()
if (m_is_recreating_gui) return; if (m_is_recreating_gui) return;
m_is_closing = true; 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"; 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 class wxBoostLog : public wxLog
{ {
void DoLogText(const wxString &msg) override { void DoLogText(const wxString &msg) override {

View File

@ -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); 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(); std::string get_local_models_path();
bool OnInit() override; bool OnInit() override;
int OnExit() override;
bool initialized() const { return m_initialized; } bool initialized() const { return m_initialized; }
std::map<std::string, bool> test_url_state; std::map<std::string, bool> test_url_state;