Browse Source

Fix an obvious memory leak.

This thing was pissing me off, which made me piss off a lot of other people,
which pissed off even more people, so the entire planet got pissed off and
nuclear warfare began. So, let's not do stupid crap and piss me off, okay?
Adam Johnson 13 years ago
parent
commit
8cbde377ef
  1. 6
      Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp

6
Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp

@ -358,7 +358,6 @@ void plSimulationMgr::Init()
if (gTheInstance->InitSimulation()) if (gTheInstance->InitSimulation())
{ {
gTheInstance->RegisterAs(kSimulationMgr_KEY); gTheInstance->RegisterAs(kSimulationMgr_KEY);
gTheInstance->GetKey()->RefObject();
plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), gTheInstance->GetKey()); plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), gTheInstance->GetKey());
} }
else else
@ -376,11 +375,8 @@ void plSimulationMgr::Shutdown()
hsAssert(gTheInstance, "Simulation manager missing during shutdown."); hsAssert(gTheInstance, "Simulation manager missing during shutdown.");
if (gTheInstance) if (gTheInstance)
{ {
// UnRef to match our Ref in Init(). Unless something strange is
// going on, this should destroy the instance and set gTheInstance to nil.
// gTheInstance->GetKey()->UnRefObject();
plgDispatch::Dispatch()->UnRegisterForExactType(plAgeLoadedMsg::Index(), gTheInstance->GetKey()); plgDispatch::Dispatch()->UnRegisterForExactType(plAgeLoadedMsg::Index(), gTheInstance->GetKey());
gTheInstance->UnRegister(); // this will destroy the instance gTheInstance->UnRegisterAs(kSimulationMgr_KEY); // this will destroy the instance
gTheInstance = nil; gTheInstance = nil;
} }
} }

Loading…
Cancel
Save