From e95b1b6ea7a6dc7066e93cf34a42b481ea969eac Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 21 Aug 2023 16:59:46 +0800 Subject: [PATCH] FIX: [STUDIO-3886] cancel and join sync thread when app closing Change-Id: I9d9efb24d31489b31e72b6bee0e0d67882b613b2 --- src/slic3r/GUI/GUI_App.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index e8b0687bb..7ea3b62d8 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4597,7 +4597,7 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg) }); }; cancelFn = [this, dlg]() { - return dlg->WasCanceled(); + return m_is_closing || dlg->WasCanceled(); }; finishFn = [this, userid = m_agent->get_user_id(), dlg](bool ok) { CallAfter([=]{ @@ -4689,8 +4689,12 @@ void GUI_App::stop_sync_user_preset() return; enable_sync = false; - if (m_sync_update_thread.joinable()) - m_sync_update_thread.detach(); + if (m_sync_update_thread.joinable()) { + if (m_is_closing) + m_sync_update_thread.join(); + else + m_sync_update_thread.detach(); + } } void GUI_App::start_http_server()