From ca122fbb645215a6d3f76c50b50d962704c6559f Mon Sep 17 00:00:00 2001 From: Aster Seker Date: Tue, 19 May 2026 01:40:59 +0300 Subject: [PATCH] test(logging): drain mixed-mode probe logger Make the per_logger_mixed_mode_test probe logger call shutdown from its destructor so tasks submitted to the global TaskExecutor cannot run after the stack logger is destroyed. This mirrors the built-in async logger lifecycle and fixes the macOS post-main crash where the test printed all PASS lines but CTest still observed a failed process exit. --- tests/per_logger_mixed_mode_test.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/per_logger_mixed_mode_test.cpp b/tests/per_logger_mixed_mode_test.cpp index 818ab56..40d612c 100644 --- a/tests/per_logger_mixed_mode_test.cpp +++ b/tests/per_logger_mixed_mode_test.cpp @@ -28,7 +28,7 @@ class CountingLogger : public logit::ILogger { } ~CountingLogger() override { - if (m_executor) m_executor->shutdown(); + shutdown(); } void log(const LogRecord& record, const std::string& message) override { @@ -56,6 +56,11 @@ class CountingLogger : public logit::ILogger { else logit::detail::TaskExecutor::get_instance().wait(); } + void shutdown() override { + wait(); + if (m_executor) m_executor->shutdown(); + } + std::size_t count() const { return m_count.load(std::memory_order_relaxed); } private: