소스 검색

Workaround for crash on winning the game

Ivan Savenko 1 년 전
부모
커밋
5d16f035d7
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      lib/serializer/Connection.cpp

+ 7 - 1
lib/serializer/Connection.cpp

@@ -222,7 +222,13 @@ int CConnection::read(void * data, unsigned size)
 CConnection::~CConnection()
 {
 	if(handler)
-		handler->join();
+	{
+		// ugly workaround to avoid self-join if last strong reference to shared_ptr that owns this class has been released in this very thread, e.g. on netpack processing
+		if (boost::this_thread::get_id() != handler->get_id())
+			handler->join();
+		else
+			handler->detach();
+	}
 
 	close();
 }