Skip to content

Commit

Permalink
fix crash on game close when demo recording
Browse files Browse the repository at this point in the history
  • Loading branch information
nillerusr committed Oct 4, 2023
1 parent b7bd94c commit efeda62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion engine/cl_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void CDemoRecorder::CloseDemoFile()

m_DemoFile.Close();

g_ClientDLL->OnDemoRecordStop();
if( g_ClientDLL ) g_ClientDLL->OnDemoRecordStop();
}

m_bCloseDemoFile = false;
Expand Down
22 changes: 3 additions & 19 deletions engine/cmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,18 @@ csurface_t *CCollisionBSPData::GetSurfaceAtIndex( unsigned short surfaceIndex )
return &map_surfaces[surfaceIndex];
}

#if TEST_TRACE_POOL
CTSPool<TraceInfo_t> g_TraceInfoPool;
#else
class CTraceInfoPool : public CTSList<TraceInfo_t *>
{
public:
CTraceInfoPool() = default;
};

CTraceInfoPool g_TraceInfoPool;
#endif
TraceInfo_t g_TraceInfo;

TraceInfo_t *BeginTrace()
{
#if TEST_TRACE_POOL
TraceInfo_t *pTraceInfo = g_TraceInfoPool.GetObject();
#else
TraceInfo_t *pTraceInfo;
if ( !g_TraceInfoPool.PopItem( &pTraceInfo ) )
{
pTraceInfo = new TraceInfo_t;
}
#endif
TraceInfo_t * pTraceInfo = &g_TraceInfo;

if ( pTraceInfo->m_BrushCounters[0].Count() != GetCollisionBSPData()->numbrushes + 1 )
{
memset( pTraceInfo->m_Count, 0, sizeof( pTraceInfo->m_Count ) );
Expand Down Expand Up @@ -118,11 +107,6 @@ void EndTrace( TraceInfo_t *&pTraceInfo )
{
PopTraceVisits( pTraceInfo );
Assert( pTraceInfo->m_nCheckDepth == -1 );
#if TEST_TRACE_POOL
g_TraceInfoPool.PutObject( pTraceInfo );
#else
g_TraceInfoPool.PushItem( pTraceInfo );
#endif
pTraceInfo = NULL;
}

Expand Down

0 comments on commit efeda62

Please sign in to comment.