From 32ea737009f39c1b70cb72898c8d095f7df5fd23 Mon Sep 17 00:00:00 2001 From: Yuri Benditovich Date: Thu, 22 Jun 2023 21:24:22 +0300 Subject: [PATCH] netkvm-prot: fix stopped state indication Indicate stopped state only after the thread is finished. Otherwise the structures in the memory might be unpredictably modified. Signed-off-by: Yuri Benditovich --- NetKVM/ProtocolService/ProtocolService.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NetKVM/ProtocolService/ProtocolService.cpp b/NetKVM/ProtocolService/ProtocolService.cpp index 1fe3ddeb..12131644 100644 --- a/NetKVM/ProtocolService/ProtocolService.cpp +++ b/NetKVM/ProtocolService/ProtocolService.cpp @@ -704,6 +704,10 @@ protected: { StopThread(); m_ThreadEvent.Set(); + while (IsThreadRunning()) + { + Sleep(50); + } return true; } virtual void ThreadProc()