Skip to content

Commit

Permalink
actually fix KV crash in game rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercoms committed Oct 7, 2020
1 parent c6c5e4c commit 836a537
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 6 additions & 6 deletions game/shared/tf/tf_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18000,16 +18000,16 @@ const char *CTFGameRules::GetTeamGoalString( int iTeam )

CTFGameRules::~CTFGameRules()
{
if ( m_pkvVisionFilterTranslations )
if (m_pkvVisionFilterTranslationsParticle)
{
m_pkvVisionFilterTranslations->deleteThis();
m_pkvVisionFilterTranslations = NULL;
// We don't delete, because it's deleted in the parent below.
m_pkvVisionFilterTranslationsParticle = NULL;
}

if (m_pkvVisionFilterTranslationsParticle)
if ( m_pkvVisionFilterTranslations )
{
m_pkvVisionFilterTranslationsParticle->deleteThis();
m_pkvVisionFilterTranslationsParticle = NULL;
m_pkvVisionFilterTranslations->deleteThis();
m_pkvVisionFilterTranslations = NULL;
}

if ( m_pkvVisionFilterShadersMapWhitelist )
Expand Down
10 changes: 2 additions & 8 deletions tier1/KeyValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2807,18 +2807,12 @@ void *KeyValues::operator new( size_t iAllocSize, int nBlockUse, const char *pFi
//-----------------------------------------------------------------------------
void KeyValues::operator delete( void *pMem )
{
if (pMem)
{
KeyValuesSystem()->FreeKeyValuesMemory(pMem);
}
KeyValuesSystem()->FreeKeyValuesMemory(pMem);
}

void KeyValues::operator delete( void *pMem, int nBlockUse, const char *pFileName, int nLine )
{
if (pMem)
{
KeyValuesSystem()->FreeKeyValuesMemory(pMem);
}
KeyValuesSystem()->FreeKeyValuesMemory(pMem);
}

void KeyValues::UnpackIntoStructure( KeyValuesUnpackStructure const *pUnpackTable, void *pDest, size_t DestSizeInBytes )
Expand Down

0 comments on commit 836a537

Please sign in to comment.