diff --git a/include/spdlog/details/console_globals.h b/include/spdlog/details/console_globals.h index 9c552106..5710fd4d 100644 --- a/include/spdlog/details/console_globals.h +++ b/include/spdlog/details/console_globals.h @@ -12,7 +12,7 @@ namespace details { struct console_mutex { using mutex_t = std::mutex; static mutex_t &mutex() { - static mutex_t s_mutex; + static mutex_t& s_mutex = *new mutex_t; return s_mutex; } }; @@ -20,7 +20,7 @@ struct console_mutex { struct console_nullmutex { using mutex_t = null_mutex; static mutex_t &mutex() { - static mutex_t s_mutex; + static mutex_t& s_mutex = *new mutex_t; return s_mutex; } }; diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index f447848e..dc568928 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -234,7 +234,7 @@ SPDLOG_INLINE void registry::set_levels(log_levels levels, level::level_enum *gl } SPDLOG_INLINE registry ®istry::instance() { - static registry s_instance; + static registry& s_instance = *new registry; return s_instance; } diff --git a/include/spdlog/mdc.h b/include/spdlog/mdc.h index 41f0c1f3..7024db04 100644 --- a/include/spdlog/mdc.h +++ b/include/spdlog/mdc.h @@ -38,7 +38,7 @@ public: static void clear() { get_context().clear(); } static mdc_map_t &get_context() { - static thread_local mdc_map_t context; + static thread_local mdc_map_t& context = *new mdc_map_t; return context; } };