[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48742] trunk/blender/source/gameengine/ Physics/Bullet: Fixing a memory leak introduced by the Character Physics type patch: a new btGhostPairCallback was being created, but never freed.

Mitchell Stokes mogurijin at gmail.com
Sun Jul 8 22:05:40 CEST 2012


Revision: 48742
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48742
Author:   moguri
Date:     2012-07-08 20:05:40 +0000 (Sun, 08 Jul 2012)
Log Message:
-----------
Fixing a memory leak introduced by the Character Physics type patch: a new btGhostPairCallback was being created, but never freed.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
    trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp	2012-07-08 20:00:48 UTC (rev 48741)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp	2012-07-08 20:05:40 UTC (rev 48742)
@@ -338,6 +338,7 @@
 m_solver(NULL),
 m_ownPairCache(NULL),
 m_filterCallback(NULL),
+m_ghostPairCallback(NULL),
 m_ownDispatcher(NULL),
 m_scalingPropagated(false)
 {
@@ -369,8 +370,9 @@
 	}
 
 	m_filterCallback = new CcdOverlapFilterCallBack(this);
+	m_ghostPairCallback = new btGhostPairCallback();
 	m_broadphase->getOverlappingPairCache()->setOverlapFilterCallback(m_filterCallback);
-	m_broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
+	m_broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(m_ghostPairCallback);
 
 	setSolverType(1);//issues with quickstep and memory allocations
 //	m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
@@ -1886,6 +1888,9 @@
 	if (NULL != m_filterCallback)
 		delete m_filterCallback;
 
+	if (NULL != m_ghostPairCallback)
+		delete m_ghostPairCallback;
+
 	if (NULL != m_collisionConfiguration)
 		delete m_collisionConfiguration;
 

Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
===================================================================
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h	2012-07-08 20:00:48 UTC (rev 48741)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h	2012-07-08 20:05:40 UTC (rev 48742)
@@ -280,6 +280,8 @@
 
 		class CcdOverlapFilterCallBack* m_filterCallback;
 
+		class btGhostPairCallback*	m_ghostPairCallback;
+
 		class btDispatcher* m_ownDispatcher;
 
 		bool	m_scalingPropagated;




More information about the Bf-blender-cvs mailing list