remove memory leak in A_ChangeModel

This commit is contained in:
Ricardo Luís Vaz Silva 2023-04-19 10:24:39 -03:00 committed by Rachael Alexanderson
parent bc41356b35
commit 7dda6570ec

View file

@ -5155,13 +5155,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeModel)
if (mobj->modelData == nullptr)
{
auto ptr = Create<DActorModelData>();
ptr->hasModel = mobj->hasmodel ? 1 : 0;
ptr->modelIDs = *new TArray<int>();
ptr->skinIDs = *new TArray<FTextureID>();
ptr->surfaceSkinIDs = *new TArray<FTextureID>();
ptr->animationIDs = *new TArray<int>();
ptr->modelFrameGenerators = *new TArray<int>();
ptr->modelDef = NAME_None;
mobj->modelData = ptr;
mobj->hasmodel = 1;
GC::WriteBarrier(mobj, ptr);