From 446181e7b3e40af0169a1bb36a33db9866792f13 Mon Sep 17 00:00:00 2001 From: Nikolay Bolgurtsev Date: Mon, 8 Jun 2026 11:25:56 +0000 Subject: [PATCH] Fix race in Acceptor::stop() by calling onStop() after thread_join() Previously onStop() was called before joining the acceptor thread, so teardown could destroy resources while the thread running onStart() was still using them. Move onStop() after thread_join() so the thread is fully joined before teardown. Co-Authored-By: Claude Opus 4.8 --- src/C++/Acceptor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/C++/Acceptor.cpp b/src/C++/Acceptor.cpp index 39d4fc280..c5abd3585 100644 --- a/src/C++/Acceptor.cpp +++ b/src/C++/Acceptor.cpp @@ -227,11 +227,11 @@ void Acceptor::stop(bool force) { } m_stop = true; - onStop(); if (m_threadid) { thread_join(m_threadid); } m_threadid = 0; + onStop(); for (Session *session : enabledSessions) { session->logon();