Skip to content

Commit

Permalink
Fix reference counting in HLodClass::Remove_Sub_Object
Browse files Browse the repository at this point in the history
  • Loading branch information
xezon committed Aug 11, 2024
1 parent bd8781e commit 8dd0247
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/w3d/renderer/hlod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ int HLodClass::Remove_Sub_Object(RenderObjClass *subobj)
for (int i = 0; i < m_lodCount && !deleted; i++) {
for (int j = 0; j < m_lod[i].Count() && !deleted; j++) {
if (m_lod[i][j].m_model == subobj) {
m_lod[i][j].m_model->Release_Ref();
m_lod[i].Delete(j);
deleted = true;

Expand All @@ -880,6 +881,7 @@ int HLodClass::Remove_Sub_Object(RenderObjClass *subobj)

for (int i = 0; i < m_additionalModels.Count() && !deleted; i++) {
if (m_additionalModels[i].m_model == subobj) {
m_additionalModels[i].m_model->Release_Ref();
m_additionalModels.Delete(i);
deleted = true;
iscurrent = true;
Expand All @@ -898,7 +900,6 @@ int HLodClass::Remove_Sub_Object(RenderObjClass *subobj)
}
}

subobj->Release_Ref();
Update_Sub_Object_Bits();
Update_Obj_Space_Bounding_Volumes();
return 1;
Expand Down

0 comments on commit 8dd0247

Please sign in to comment.