Fixed bug where destroyed objects in love.physics cause crash when collected.

This commit is contained in:
rude
2009-11-10 23:25:12 +01:00
parent ee59f28e04
commit 86ac10c3f6
6 changed files with 19 additions and 7 deletions
@@ -42,8 +42,6 @@ namespace box2d
CircleShape::~CircleShape()
{
body->body->DestroyShape(shape);
shape = 0;
}
float CircleShape::getRadius() const
@@ -42,8 +42,6 @@ namespace box2d
PolygonShape::~PolygonShape()
{
body->body->DestroyShape(shape);
shape = 0;
}
int PolygonShape::getPoints(lua_State * L)
+5
View File
@@ -48,6 +48,11 @@ namespace box2d
delete data;
data = 0;
body->body->DestroyShape(shape);
shape = 0;
body->release();
}
Shape::Type Shape::getType() const
+5 -1
View File
@@ -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;
}
+5 -1
View File
@@ -80,8 +80,12 @@ namespace box2d
int w_Joint_destroy(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
Proxy * p = (Proxy *)lua_touserdata(L, 1);
p->own = false;
Joint * t = (Joint *)p->data;
t->release();
return 0;
}
+4 -1
View File
@@ -200,7 +200,10 @@ namespace box2d
int w_Shape_destroy(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
Proxy * p = (Proxy *)lua_touserdata(L, 1);
p->own = false;
Shape * t = (Shape *)p->data;
t->release();
return 0;
}