Netconsole: fix race condition caused by misplaced mutex

Mutex should be locked before IsConnected(), as IsConnected() accesses CSocketCreator which checks a vector (not thread safe), lock the mutex in the correct place.
This commit is contained in:
Kawe Mazidjatari 2024-02-22 02:00:09 +01:00
parent 1674200764
commit 869741b3b3

View File

@ -278,10 +278,10 @@ bool CNetCon::RunFrame(void)
{
if (IsInitialized())
{
std::lock_guard<std::mutex> l(m_Mutex);
if (IsConnected())
{
std::lock_guard<std::mutex> l(m_Mutex);
CConnectedNetConsoleData& pData = GetSocketCreator()->GetAcceptedSocketData(0);
Recv(pData);
}