FIX: gui: fix the crash issue on arm64 plateform

jira: no-jira
Change-Id: Ib95ffc3ceb421af345418d73af0261d3c25464a3
(cherry picked from commit 132d87b687f4b3bd016539380d7e9268d817ac40)
This commit is contained in:
lane.wei 2025-04-11 17:41:06 +08:00 committed by Noisyfox
parent c0ba405a64
commit aec877c7e0

View file

@ -1225,6 +1225,17 @@ int GUI_App::download_plugin(std::string name, std::string package_name, Install
fs::path tmp_path = target_file_path;
tmp_path += format(".%1%%2%", get_current_pid(), ".tmp");
#if defined(__WINDOWS__)
if (is_running_on_arm64()) {
//set to arm64 for plugins
std::map<std::string, std::string> current_headers = Slic3r::Http::get_extra_headers();
current_headers["X-BBL-OS-Type"] = "windows_arm";
Slic3r::Http::set_extra_headers(current_headers);
BOOST_LOG_TRIVIAL(info) << boost::format("download_plugin: set X-BBL-OS-Type to windows_arm");
}
#endif
// get_url
std::string url = get_plugin_url(name, app_config->get_country_code());
std::string download_url;
@ -1282,6 +1293,17 @@ int GUI_App::download_plugin(std::string name, std::string package_name, Install
result = -1;
}).perform_sync();
#if defined(__WINDOWS__)
if (is_running_on_arm64()) {
//set back
std::map<std::string, std::string> current_headers = Slic3r::Http::get_extra_headers();
current_headers["X-BBL-OS-Type"] = "windows";
Slic3r::Http::set_extra_headers(current_headers);
BOOST_LOG_TRIVIAL(info) << boost::format("download_plugin: set X-BBL-OS-Type back to windows");
}
#endif
bool cancel = false;
if (result < 0) {
j["result"] = "failed";