mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-15 14:10:11 +00:00
Fix for memory leak at btCreateCompoundFromGimpactShape
This is an fix for issue #1213
This commit is contained in:
parent
afd6db7c40
commit
b7011a864b
@ -5,6 +5,22 @@
|
||||
#include "btGImpactShape.h"
|
||||
#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
|
||||
|
||||
ATTRIBUTE_ALIGNED16(class) btCompoundFromGimpactShape : public btCompoundShape
|
||||
{
|
||||
public:
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
virtual ~btCompoundFromGimpactShape()
|
||||
{
|
||||
/*delete all the btBU_Simplex1to4 ChildShapes*/
|
||||
for (int i = 0; i < m_children.size(); i++)
|
||||
{
|
||||
delete m_children[i].m_childShape;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct MyCallback : public btTriangleRaycastCallback
|
||||
{
|
||||
int m_ignorePart;
|
||||
@ -77,7 +93,7 @@ struct MyCallback : public btTriangleRaycastCallback
|
||||
|
||||
btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimpactMesh, btScalar depth)
|
||||
{
|
||||
btCompoundShape* colShape = new btCompoundShape();
|
||||
btCompoundShape* colShape = new btCompoundFromGimpactShape();
|
||||
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
@ -90,4 +106,4 @@ btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimp
|
||||
return colShape;
|
||||
}
|
||||
|
||||
#endif //BT_COMPOUND_FROM_GIMPACT
|
||||
#endif //BT_COMPOUND_FROM_GIMPACT
|
||||
|
Loading…
Reference in New Issue
Block a user