diff --git a/repertory/librepertory/src/initialize.cpp b/repertory/librepertory/src/initialize.cpp index f6cfed8e..eee78752 100644 --- a/repertory/librepertory/src/initialize.cpp +++ b/repertory/librepertory/src/initialize.cpp @@ -53,10 +53,6 @@ #include #endif // defined(__APPLE__) -#if defined(_WIN32) -#include "utils/com_init_wrapper.hpp" -#endif // defined(_WIN32) - namespace { #if defined(PROJECT_ENABLE_CURL) bool curl_initialized{false}; @@ -79,10 +75,6 @@ auto project_initialize() -> bool { std::signal(SIGPIPE, SIG_IGN); #endif // defined(__APPLE__) -#if defined(_WIN32) - [[maybe_unused]] static const utils::com_init_wrapper wrapper; -#endif // defined(_WIN32) - #if defined(PROJECT_REQUIRE_ALPINE) && !defined(PROJECT_IS_MINGW) { static constexpr auto guard_size{4096U}; diff --git a/support/src/utils/file_directory.cpp b/support/src/utils/file_directory.cpp index 9b5601be..992ebf5d 100644 --- a/support/src/utils/file_directory.cpp +++ b/support/src/utils/file_directory.cpp @@ -173,7 +173,7 @@ auto directory::create_directory(std::string_view path) const } #if defined(_WIN32) - [[maybe_unused]] static const utils::com_init_wrapper wrapper; + [[maybe_unused]] thread_local const utils::com_init_wrapper wrapper; auto res = ::SHCreateDirectory(nullptr, utils::string::from_utf8(abs_path).c_str()); diff --git a/support/src/utils/windows.cpp b/support/src/utils/windows.cpp index c5cbd1cd..66ca722f 100644 --- a/support/src/utils/windows.cpp +++ b/support/src/utils/windows.cpp @@ -66,7 +66,7 @@ auto get_last_error_code() -> DWORD { return ::GetLastError(); } auto get_local_app_data_directory() -> const std::string & { REPERTORY_USES_FUNCTION_NAME(); - [[maybe_unused]] static const utils::com_init_wrapper wrapper; + [[maybe_unused]] thread_local const utils::com_init_wrapper wrapper; static std::string app_data = ([]() -> std::string { PWSTR local_app_data{}; @@ -145,7 +145,7 @@ auto run_process_elevated(std::vector args) -> int { void set_last_error_code(DWORD error_code) { ::SetLastError(error_code); } auto get_startup_folder() -> std::wstring { - [[maybe_unused]] static const utils::com_init_wrapper wrapper; + [[maybe_unused]] thread_local const utils::com_init_wrapper wrapper; PWSTR raw{nullptr}; auto result = ::SHGetKnownFolderPath(FOLDERID_Startup, 0, nullptr, &raw); @@ -165,7 +165,7 @@ auto get_startup_folder() -> std::wstring { auto create_shortcut(const shortcut_cfg &cfg, bool overwrite_existing) -> bool { REPERTORY_USES_FUNCTION_NAME(); - [[maybe_unused]] static const utils::com_init_wrapper wrapper; + [[maybe_unused]] thread_local const utils::com_init_wrapper wrapper; const auto hr_hex = [](HRESULT result) -> std::string { std::ostringstream oss;