Merge pull request #381 from Nbc66/develop

Fixed "color_correction_volume" crash caused by dangling pointers inside of ccmngr
This commit is contained in:
Blixibon 2025-02-08 16:26:27 -06:00 committed by GitHub
commit 471ffb419d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -157,6 +157,22 @@ void CColorCorrectionMgr::CommitColorCorrectionWeights()
}
m_colorCorrectionWeights.RemoveAll();
}
void CColorCorrectionMgr::LevelShutdownPreEntity()
{
//Clean up the vectors when shuting down a level
//will keep dangling pointers inside of the vector causing a nullptr crash
if (g_ColorCorrectionVolumeList.Base())
{
g_ColorCorrectionVolumeList.Purge();
}
if (g_ColorCorrectionList.Base())
{
g_ColorCorrectionList.Purge();
}
}
#else
void CColorCorrectionMgr::SetColorCorrectionWeight( ClientCCHandle_t h, float flWeight )
{

View File

@ -76,6 +76,8 @@ private:
CUtlVector< SetWeightParams_t > m_colorCorrectionWeights;
void CommitColorCorrectionWeights();
void LevelShutdownPreEntity();
#endif
};