FIX: query hms crash while there is updating hms in other thread

jira: [STUDIO-9380]

Change-Id: I1b3d94008d4d03d3d41c10e1240fe832755ef9da
(cherry picked from commit 0d367638b58c046799f5212f2fca76c15f1d4dfe)
This commit is contained in:
xin.zhang
2025-09-06 23:57:31 +08:00
committed by Noisyfox
parent 9e3e2f05b8
commit 937ed0702f
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -11,6 +11,7 @@
#include "slic3r/Utils/Http.hpp"
#include "libslic3r/Thread.hpp"
#include "nlohmann/json.hpp"
#include <mutex>
namespace Slic3r {
namespace GUI {
@@ -20,9 +21,12 @@ namespace GUI {
#define QUERY_HMS_ACTION "query_hms_action"
class HMSQuery {
protected:
json m_hms_info_json;
json m_hms_action_json;
mutable std::mutex m_hms_mutex;
int download_hms_related(std::string hms_type, json *receive_json, std::string dev_type);
int load_from_local(std::string &version_info, std::string hms_type, json *load_json, std::string dev_type);
int save_to_local(std::string lang, std::string hms_type, std::string dev_type, json save_json);
@@ -30,6 +34,7 @@ protected:
wxString _query_hms_msg(std::string long_error_code, std::string lang_code = std::string("en")) const;
bool _query_error_msg(wxString &error_msg, std::string long_error_code, std::string lang_code = std::string("en"));
wxString _query_error_url_action(std::string long_error_code, std::string dev_id, std::vector<int>& button_action);
public:
HMSQuery() {}
int check_hms_info(std::string dev_type = "00M");