Update registry-inl.h fix #2691

This commit is contained in:
Gabi Melman 2023-04-23 03:21:17 +03:00 committed by GitHub
parent 0ca574ae16
commit e539d6ae42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,8 +219,9 @@ SPDLOG_INLINE void registry::flush_all()
SPDLOG_INLINE void registry::drop(const std::string &logger_name)
{
std::lock_guard<std::mutex> 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();
}