From f7c182585b32e4fbfae7cf26e91eb193216828ec Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 11 Mar 2025 09:30:16 +0800 Subject: signal(session,sessionManager): atexit handler sometimes have malloc: Heap corruption detected :/ --- src/sessionManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/sessionManager.cpp') diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp index f4573e1..b4e1ad5 100644 --- a/src/sessionManager.cpp +++ b/src/sessionManager.cpp @@ -6,7 +6,15 @@ #include #include "log.hpp" +void CSessionManager::shutdownSessions() { + for (const auto &[thread, session] : m_vSessions) + session->onShutdown(); +} + CSessionManager::CSessionManager() { + if (std::atexit([]() { g_pSessionManager->shutdownSessions(); })) + log(ERR, "Failed to register SessionManager atexit handler, will fallback to quick_exit after hang"); + log(LOG, "SessionManager: initialized"); }; -- cgit v1.2.3