Skip to content

Commit e0c5d9c

Browse files
committed
[engine] Fix sv_parallel_sendsnapshot crashing
Origin: RaphaelIT7@87f2ca1
1 parent ee09a8e commit e0c5d9c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

engine/framesnapshot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class CFrameSnapshotManager
166166
private:
167167
void DeleteFrameSnapshot( CFrameSnapshot* pSnapshot );
168168

169+
CThreadFastMutex m_FrameSnapshotsWriteMutex;
169170
CUtlLinkedList<CFrameSnapshot*, unsigned short> m_FrameSnapshots;
170171
CClassMemoryPool< PackedEntity > m_PackedEntitiesPool;
171172

engine/sv_framesnapshot.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ CFrameSnapshot* CFrameSnapshotManager::CreateEmptySnapshot( int tickcount, int m
100100
entry++;
101101
}
102102

103+
m_FrameSnapshotsWriteMutex.Lock();
103104
snap->m_ListIndex = m_FrameSnapshots.AddToTail( snap );
105+
m_FrameSnapshotsWriteMutex.Unlock();
104106
return snap;
105107
}
106108

@@ -190,7 +192,9 @@ void CFrameSnapshotManager::DeleteFrameSnapshot( CFrameSnapshot* pSnapshot )
190192
}
191193
}
192194

195+
m_FrameSnapshotsWriteMutex.Lock();
193196
m_FrameSnapshots.Remove( pSnapshot->m_ListIndex );
197+
m_FrameSnapshotsWriteMutex.Unlock();
194198
delete pSnapshot;
195199
}
196200

engine/sv_main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,9 @@ void CGameServer::CopyTempEntities( CFrameSnapshot* pSnapshot )
17881788
// are running many instances anyway. It's off in Dota and CSGO dedicated servers.
17891789
//
17901790
// Bruce also had a patch to disable this in //ValveGames/staging/game/tf/cfg/unencrypted/print_instance_config.py
1791-
static ConVar sv_parallel_sendsnapshot( "sv_parallel_sendsnapshot", "0" );
1791+
//
1792+
// NOTE: The crash should be fixed.
1793+
static ConVar sv_parallel_sendsnapshot( "sv_parallel_sendsnapshot", "1" );
17921794

17931795
static void SV_ParallelSendSnapshot( CGameClient *& pClient )
17941796
{

0 commit comments

Comments
 (0)