1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix remaining memory leaks caused by API misuse

This commit is contained in:
Ivan Savenko
2025-04-28 13:55:57 +03:00
parent c0fb1d1b3b
commit 554a414302
6 changed files with 17 additions and 8 deletions

View File

@@ -57,6 +57,7 @@
#include "LobbyClientNetPackVisitors.h"
#include <vcmi/events/EventBus.h>
#include <SDL_thread.h>
#include <boost/lexical_cast.hpp>
@@ -114,9 +115,13 @@ void CServerHandler::threadRunNetwork()
}
catch (const TerminationRequestedException &)
{
// VCMI can run SDL methods on network thread, leading to usage of thread-local storage by SDL
// Such storage needs to be cleaned up manually for threads that were not created by SDL
SDL_TLSCleanup();
logGlobal->info("Terminating network thread");
return;
}
SDL_TLSCleanup();
logGlobal->info("Ending network thread");
}