[Bf-blender-cvs] [36d47ce] master: Fix leak in BMesh convex hull operator
Campbell Barton
noreply at git.blender.org
Sat May 30 08:20:17 CEST 2015
Commit: 36d47ce2035a8eb6912f299e848b487a8431abcd
Author: Campbell Barton
Date: Sat May 30 16:17:04 2015 +1000
Branches: master
https://developer.blender.org/rB36d47ce2035a8eb6912f299e848b487a8431abcd
Fix leak in BMesh convex hull operator
===================================================================
M extern/bullet2/src/Bullet-C-Api.h
M extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
M source/blender/bmesh/operators/bmo_hull.c
===================================================================
diff --git a/extern/bullet2/src/Bullet-C-Api.h b/extern/bullet2/src/Bullet-C-Api.h
index 2eabf38..5d00f7e 100644
--- a/extern/bullet2/src/Bullet-C-Api.h
+++ b/extern/bullet2/src/Bullet-C-Api.h
@@ -171,6 +171,7 @@ extern "C" {
/* Convex Hull */
PL_DECLARE_HANDLE(plConvexHull);
plConvexHull plConvexHullCompute(float (*coords)[3], int count);
+ void plConvexHullDelete(plConvexHull hull);
int plConvexHullNumVertices(plConvexHull hull);
int plConvexHullNumFaces(plConvexHull hull);
void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp b/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
index 21f0aa9..e1f69af 100644
--- a/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
+++ b/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
@@ -413,6 +413,12 @@ plConvexHull plConvexHullCompute(float (*coords)[3], int count)
return reinterpret_cast<plConvexHull>(computer);
}
+void plConvexHullDelete(plConvexHull hull)
+{
+ btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+ delete computer;
+}
+
int plConvexHullNumVertices(plConvexHull hull)
{
btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index fe4a020..2dfad5a 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -537,6 +537,9 @@ static void hull_from_bullet(
}
BLI_array_free(fvi);
+
+ plConvexHullDelete(hull);
+
MEM_freeN(hull_verts);
MEM_freeN(coords);
MEM_freeN(input_verts);
More information about the Bf-blender-cvs
mailing list