From e4984955894d5c0593e966f454bda5bb7d095dec Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 14 Jun 2012 21:27:55 +0200 Subject: [PATCH] fix a leak: physics heightfield was only destroyed on cell change and not on exit --- libs/openengine/bullet/physic.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index a94434e5b..354b4d589 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -222,6 +222,14 @@ namespace Physic PhysicEngine::~PhysicEngine() { + HeightFieldContainer::iterator hf_it = mHeightFieldMap.begin(); + for (; hf_it != mHeightFieldMap.end(); ++hf_it) + { + dynamicsWorld->removeRigidBody(hf_it->second.mBody); + delete hf_it->second.mShape; + delete hf_it->second.mBody; + } + RigidBodyContainer::iterator rb_it = RigidBodyMap.begin(); for (; rb_it != RigidBodyMap.end(); ++rb_it) {