From 45bf4a99f1eba26683bc706c37c5ec69a29148f6 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Tue, 7 Oct 2025 09:57:17 +0800 Subject: [PATCH] Fix issue that connection failed dialog keeps popping up if lan device is offline --- src/slic3r/GUI/GUI_App.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 6491f76b53..df379c9b9d 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1767,20 +1767,19 @@ void GUI_App::init_networking_callbacks() event.SetString(obj->get_dev_id()); GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj); } else if (state == ConnectStatus::ConnectStatusFailed) { - // Orca: avoid showing same error message multiple times until next connection attempt. - const auto already_disconnected = m_device_manager->selected_machine.empty(); + // Orca: only update status if same device id + if (m_device_manager->selected_machine != dev_id) return; + m_device_manager->set_selected_machine(""); - if (!already_disconnected) { - wxString text; - if (msg == "5") { - obj->set_access_code(""); - obj->erase_user_access_code(); - text = wxString::Format(_L("Incorrect password")); - wxGetApp().show_dialog(text); - } else { - text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->get_dev_name()), obj->get_dev_id(), msg); - wxGetApp().show_dialog(text); - } + wxString text; + if (msg == "5") { + obj->set_access_code(""); + obj->erase_user_access_code(); + text = wxString::Format(_L("Incorrect password")); + wxGetApp().show_dialog(text); + } else { + text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->get_dev_name()), obj->get_dev_id(), msg); + wxGetApp().show_dialog(text); } event.SetInt(-1); } else if (state == ConnectStatus::ConnectStatusLost) {