@@ -42,8 +42,6 @@ namespace box2d
CircleShape::~CircleShape()
{
- body->body->DestroyShape(shape);
- shape = 0;
}
float CircleShape::getRadius() const
PolygonShape::~PolygonShape()
int PolygonShape::getPoints(lua_State * L)
@@ -48,6 +48,11 @@ namespace box2d
delete data;
data = 0;
+
+ body->body->DestroyShape(shape);
+ shape = 0;
+ body->release();
Shape::Type Shape::getType() const
@@ -400,8 +400,12 @@ namespace box2d
int w_Body_destroy(lua_State * L)
- Body * t = luax_checkbody(L, 1);
+ Proxy * p = (Proxy *)lua_touserdata(L, 1);
+ p->own = false;
+ Body * t = (Body *)p->data;
t->release();
return 0;
@@ -80,8 +80,12 @@ namespace box2d
int w_Joint_destroy(lua_State * L)
- Joint * t = luax_checkjoint(L, 1);
+ Joint * t = (Joint *)p->data;
@@ -200,7 +200,10 @@ namespace box2d
int w_Shape_destroy(lua_State * L)
- Shape * t = luax_checkshape(L, 1);
+ Shape * t = (Shape *)p->data;