From efeda62add683af600da414ca61735d7c4f33351 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Wed, 4 Oct 2023 22:22:24 +0300 Subject: [PATCH] fix crash on game close when demo recording --- engine/cl_demo.cpp | 2 +- engine/cmodel.cpp | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/engine/cl_demo.cpp b/engine/cl_demo.cpp index f4417878d..f7d96ec43 100644 --- a/engine/cl_demo.cpp +++ b/engine/cl_demo.cpp @@ -686,7 +686,7 @@ void CDemoRecorder::CloseDemoFile() m_DemoFile.Close(); - g_ClientDLL->OnDemoRecordStop(); + if( g_ClientDLL ) g_ClientDLL->OnDemoRecordStop(); } m_bCloseDemoFile = false; diff --git a/engine/cmodel.cpp b/engine/cmodel.cpp index 373eea3ae..ca652789c 100644 --- a/engine/cmodel.cpp +++ b/engine/cmodel.cpp @@ -50,29 +50,18 @@ csurface_t *CCollisionBSPData::GetSurfaceAtIndex( unsigned short surfaceIndex ) return &map_surfaces[surfaceIndex]; } -#if TEST_TRACE_POOL -CTSPool g_TraceInfoPool; -#else class CTraceInfoPool : public CTSList { 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 ) ); @@ -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; }