FIX: avoid multiple unsaved dialog \(2\)

Change-Id: Ia41ede7c78d6218691694b3d3c8d05f2275bb014
This commit is contained in:
chunmao.guo 2023-06-12 15:54:09 +08:00 committed by Lane.Wei
parent e1bd4e2529
commit 415c4ede8a

View file

@ -3715,15 +3715,16 @@ void GUI_App::request_user_login(int online_login)
void GUI_App::request_user_logout()
{
if (m_agent && m_agent->is_user_login()) {
// Update data first before showing dialogs
m_agent->user_logout();
m_agent->set_user_selected_machine("");
/* delete old user settings */
bool transfer_preset_changes = false;
wxString header = _L("Some presets are modified.") + "\n" +
_L("You can keep the modifield presets to the new project, discard or save changes as new presets.");
using ab = UnsavedChangesDialog::ActionButtons;
wxGetApp().check_and_keep_current_preset_changes(_L("User logged out"), header, ab::KEEP | ab::SAVE, &transfer_preset_changes);
m_agent->user_logout();
m_agent->set_user_selected_machine("");
/* delete old user settings */
m_device_manager->clean_user_info();
GUI::wxGetApp().sidebar().load_ams_list({}, {});
remove_user_presets();