Skip to content

Commit

Permalink
Fix bad destructor for buildings (#3690)
Browse files Browse the repository at this point in the history
This fixes random crashes/regressions after `engineSetPoolCapacity`
  • Loading branch information
TheNormalnij authored Sep 3, 2024
1 parent 48f94d8 commit 7daa694
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Client/game_sa/CBuildingsPoolSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ void CBuildingsPoolSA::RemoveBuilding(CBuilding* pBuilding)
// Remove plant
pGame->GetPlantManager()->RemovePlant(pInterface);

RemoveBuildingFromWorld(pInterface);
// Remove shadow
pInterface->RemoveShadows();

// Remove building from world
pGame->GetWorld()->Remove(pInterface, CBuildingPool_Destructor);

// Call virtual destructor
((void*(__thiscall*)(void*, char))pInterface->vtbl->SCALAR_DELETING_DESTRUCTOR)(pInterface, 0);

// Remove col reference
auto modelInfo = pGame->GetModelInfo(pBuilding->GetModelIndex());
Expand Down

0 comments on commit 7daa694

Please sign in to comment.