fix crash on game close when demo recording

This commit is contained in:
nillerusr 2023-10-04 22:22:24 +03:00
parent b7bd94c52e
commit efeda62add
2 changed files with 4 additions and 20 deletions

View File

@ -686,7 +686,7 @@ void CDemoRecorder::CloseDemoFile()
m_DemoFile.Close(); m_DemoFile.Close();
g_ClientDLL->OnDemoRecordStop(); if( g_ClientDLL ) g_ClientDLL->OnDemoRecordStop();
} }
m_bCloseDemoFile = false; m_bCloseDemoFile = false;

View File

@ -50,29 +50,18 @@ csurface_t *CCollisionBSPData::GetSurfaceAtIndex( unsigned short surfaceIndex )
return &map_surfaces[surfaceIndex]; return &map_surfaces[surfaceIndex];
} }
#if TEST_TRACE_POOL
CTSPool<TraceInfo_t> g_TraceInfoPool;
#else
class CTraceInfoPool : public CTSList<TraceInfo_t *> class CTraceInfoPool : public CTSList<TraceInfo_t *>
{ {
public: public:
CTraceInfoPool() = default; CTraceInfoPool() = default;
}; };
CTraceInfoPool g_TraceInfoPool; TraceInfo_t g_TraceInfo;
#endif
TraceInfo_t *BeginTrace() TraceInfo_t *BeginTrace()
{ {
#if TEST_TRACE_POOL TraceInfo_t * pTraceInfo = &g_TraceInfo;
TraceInfo_t *pTraceInfo = g_TraceInfoPool.GetObject();
#else
TraceInfo_t *pTraceInfo;
if ( !g_TraceInfoPool.PopItem( &pTraceInfo ) )
{
pTraceInfo = new TraceInfo_t;
}
#endif
if ( pTraceInfo->m_BrushCounters[0].Count() != GetCollisionBSPData()->numbrushes + 1 ) if ( pTraceInfo->m_BrushCounters[0].Count() != GetCollisionBSPData()->numbrushes + 1 )
{ {
memset( pTraceInfo->m_Count, 0, sizeof( pTraceInfo->m_Count ) ); memset( pTraceInfo->m_Count, 0, sizeof( pTraceInfo->m_Count ) );
@ -118,11 +107,6 @@ void EndTrace( TraceInfo_t *&pTraceInfo )
{ {
PopTraceVisits( pTraceInfo ); PopTraceVisits( pTraceInfo );
Assert( pTraceInfo->m_nCheckDepth == -1 ); Assert( pTraceInfo->m_nCheckDepth == -1 );
#if TEST_TRACE_POOL
g_TraceInfoPool.PutObject( pTraceInfo );
#else
g_TraceInfoPool.PushItem( pTraceInfo );
#endif
pTraceInfo = NULL; pTraceInfo = NULL;
} }