FIX: [STUDIO-3886] cancel and join sync thread when app closing

Change-Id: I9d9efb24d31489b31e72b6bee0e0d67882b613b2
This commit is contained in:
chunmao.guo 2023-08-21 16:59:46 +08:00 committed by Lane.Wei
parent ab7dec0b87
commit e95b1b6ea7
1 changed files with 7 additions and 3 deletions

View File

@ -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()