FIX: [STUDIO-3886] cancel and join sync thread when app closing
Change-Id: I9d9efb24d31489b31e72b6bee0e0d67882b613b2
This commit is contained in:
parent
ab7dec0b87
commit
e95b1b6ea7
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue