From e539d6ae42e1c3e2b27852c4e2f96a7aa57fe053 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 23 Apr 2023 03:21:17 +0300 Subject: [PATCH] Update registry-inl.h fix #2691 --- include/spdlog/details/registry-inl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index 323a5c13..cb1fe84f 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -219,8 +219,9 @@ SPDLOG_INLINE void registry::flush_all() SPDLOG_INLINE void registry::drop(const std::string &logger_name) { std::lock_guard lock(logger_map_mutex_); + auto is_default_logger = default_logger_ && default_logger_->name() == logger_name; loggers_.erase(logger_name); - if (default_logger_ && default_logger_->name() == logger_name) + if (is_default_logger) { default_logger_.reset(); }