Fixed color_correction_volume crash caused by dangling pointers inside of ccmngr

This commit is contained in:
Kerim Čamdžić 2025-02-05 22:05:52 +01:00
parent 4c9d71f5e3
commit 25adddaf46
No known key found for this signature in database
GPG Key ID: E9E4EB57EB0C72EB
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
};