mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Fix issues with Shape retention in Fixture:getShape()
This commit is contained in:
@@ -128,7 +128,12 @@ namespace box2d
|
|||||||
return NULL;
|
return NULL;
|
||||||
Shape * s = (Shape *)Memoizer::find(fixture->GetShape());
|
Shape * s = (Shape *)Memoizer::find(fixture->GetShape());
|
||||||
if (!s)
|
if (!s)
|
||||||
s = new Shape(fixture->GetShape());
|
{
|
||||||
|
b2BlockAllocator a;
|
||||||
|
s = new Shape(fixture->GetShape()->Clone(&a));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s->retain();
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ namespace box2d
|
|||||||
Shape * shape = t->getShape();
|
Shape * shape = t->getShape();
|
||||||
if (shape == 0)
|
if (shape == 0)
|
||||||
return 0;
|
return 0;
|
||||||
shape->retain();
|
|
||||||
switch (shape->getType()) {
|
switch (shape->getType()) {
|
||||||
case Shape::SHAPE_EDGE:
|
case Shape::SHAPE_EDGE:
|
||||||
luax_newtype(L, "EdgeShape", PHYSICS_EDGE_SHAPE_T, (void*)shape);
|
luax_newtype(L, "EdgeShape", PHYSICS_EDGE_SHAPE_T, (void*)shape);
|
||||||
|
|||||||
Reference in New Issue
Block a user