diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 099fd6168..12ff95400 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -84,6 +84,7 @@ struct CurlGlobalInit std::unique_ptr CurlGlobalInit::instance; std::map extra_headers; +std::mutex g_mutex; struct Http::priv { @@ -470,6 +471,7 @@ void Http::priv::http_perform() Http::Http(const std::string &url) : p(new priv(url)) { + std::lock_guard l(g_mutex); for (auto it = extra_headers.begin(); it != extra_headers.end(); it++) this->header(it->first, it->second); } @@ -740,6 +742,7 @@ Http Http::del(std::string url) void Http::set_extra_headers(std::map headers) { + std::lock_guard l(g_mutex); extra_headers.swap(headers); }