1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Workaround for crash on winning the game

This commit is contained in:
Ivan Savenko 2023-11-27 13:49:45 +02:00
parent ee46fc806a
commit 5d16f035d7

View File

@ -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();
}