From 0cf1af5bbf5397d8769fd5accfb8caf5924ed0fd Mon Sep 17 00:00:00 2001 From: tt4g Date: Wed, 12 Feb 2020 16:30:44 +0900 Subject: [PATCH] Avoid references to race data filename --- include/spdlog/sinks/daily_file_sink.h | 2 +- include/spdlog/sinks/rotating_file_sink-inl.h | 2 +- include/spdlog/sinks/rotating_file_sink.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 65ab24f8..8ed5a043 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -70,7 +70,7 @@ public: } } - const filename_t &filename() + filename_t filename() { std::lock_guard lock(base_sink::mutex_); return file_helper_.filename(); diff --git a/include/spdlog/sinks/rotating_file_sink-inl.h b/include/spdlog/sinks/rotating_file_sink-inl.h index e7a2533e..f6b970ce 100644 --- a/include/spdlog/sinks/rotating_file_sink-inl.h +++ b/include/spdlog/sinks/rotating_file_sink-inl.h @@ -54,7 +54,7 @@ SPDLOG_INLINE filename_t rotating_file_sink::calc_filename(const filename } template -SPDLOG_INLINE const filename_t &rotating_file_sink::filename() +SPDLOG_INLINE filename_t rotating_file_sink::filename() { std::lock_guard lock(base_sink::mutex_); return file_helper_.filename(); diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index b7b3a1dc..e1e85a7d 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -24,7 +24,7 @@ class rotating_file_sink final : public base_sink public: rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false); static filename_t calc_filename(const filename_t &filename, std::size_t index); - const filename_t &filename(); + filename_t filename(); protected: void sink_it_(const details::log_msg &msg) override;