diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 650f249c5e7..8f1ee44edc8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -1095,6 +1095,11 @@ void W3DModelDrawModuleData::validateStuffForTimeAndWeather(const Drawable* draw //------------------------------------------------------------------------------------------------- W3DModelDrawModuleData::~W3DModelDrawModuleData() { + // Explicitly clear containers to ensure proper destruction order and prevent + // memory corruption during shutdown. Each ModelConditionInfo contains a + // PristineBoneInfoMap that must be destroyed properly before implicit cleanup. + m_conditionStates.clear(); + m_transitionMap.clear(); m_conditionStateMap.clear(); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 4c2f30d6867..9c44d4e9504 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -1117,6 +1117,11 @@ void W3DModelDrawModuleData::validateStuffForTimeAndWeather(const Drawable* draw //------------------------------------------------------------------------------------------------- W3DModelDrawModuleData::~W3DModelDrawModuleData() { + // Explicitly clear containers to ensure proper destruction order and prevent + // memory corruption during shutdown. Each ModelConditionInfo contains a + // PristineBoneInfoMap that must be destroyed properly before implicit cleanup. + m_conditionStates.clear(); + m_transitionMap.clear(); m_conditionStateMap.clear(); }