mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Fixed bug where destroyed objects in love.physics cause crash when collected.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
Proxy * p = (Proxy *)lua_touserdata(L, 1);
|
||||
p->own = false;
|
||||
|
||||
Joint * t = (Joint *)p->data;
|
||||
t->release();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user