From a7adeb6305fe31b62072e80ef0021b17c77b213a Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Mon, 10 Nov 2025 08:54:06 +0800 Subject: [PATCH] Fix crash on printer error when stealth mode is enabled (#11225) Fix crash on printer error when stealth mode is enabled (SoftFever/OrcaSlicer#11203) --- src/slic3r/GUI/GUI_App.cpp | 3 +-- src/slic3r/GUI/HMS.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 935aa7082e..3f10dbe22b 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -953,8 +953,7 @@ void GUI_App::post_init() } #endif - if (!app_config->get_stealth_mode()) - hms_query = new HMSQuery(); + hms_query = new HMSQuery(); m_show_gcode_window = app_config->get_bool("show_gcode_window"); if (m_networking_need_update) { diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index b5320576aa..8f8ec7c425 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -20,6 +20,8 @@ int get_hms_info_version(std::string& version) AppConfig* config = wxGetApp().app_config; if (!config) return -1; + if (config->get_stealth_mode()) + return -1; std::string hms_host = config->get_hms_host(); if(hms_host.empty()) { BOOST_LOG_TRIVIAL(error) << "hms_host is empty"; @@ -58,6 +60,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin AppConfig* config = wxGetApp().app_config; if (!config) return -1; + if (config->get_stealth_mode()) return -1; std::string hms_host = wxGetApp().app_config->get_hms_host(); std::string lang; @@ -541,7 +544,11 @@ wxString HMSQuery::query_print_image_action(const MachineObject* obj, int print_ char buf[32]; ::sprintf(buf, "%08X", print_error); //The first three digits of SN number - return _query_error_image_action(get_dev_id_type(obj),std::string(buf), button_action); + const auto result = _query_error_image_action(get_dev_id_type(obj),std::string(buf), button_action); + if (wxGetApp().app_config->get_stealth_mode() && result.Contains("http")) { + return wxEmptyString; + } + return result; } wxImage HMSQuery::query_image_from_local(const wxString& image_name) @@ -629,6 +636,7 @@ std::string get_hms_wiki_url(std::string error_code) { AppConfig* config = wxGetApp().app_config; if (!config) return ""; + if (config->get_stealth_mode()) return ""; std::string hms_host = wxGetApp().app_config->get_hms_host(); std::string lang_code = HMSQuery::hms_language_code(); @@ -654,6 +662,8 @@ std::string get_hms_wiki_url(std::string error_code) std::string get_error_message(int error_code) { + if (wxGetApp().app_config->get_stealth_mode()) return ""; + char buf[64]; std::string result_str = ""; std::sprintf(buf,"%08X",error_code);