Fixed a potential memory leak in the love.physics World callbacks.

This commit is contained in:
Alex Szpakowski
2014-06-18 16:24:38 -03:00
parent fb3aa060b2
commit 2ae4e9cd5a
+2 -2
View File
@@ -131,6 +131,8 @@ bool World::ContactFilter::process(Fixture *a, Fixture *b)
if (ref != 0)
{
a->retain();
b->retain();
lua_State *L = ref->getL();
ref->push();
luax_pushtype(L, "Fixture", PHYSICS_FIXTURE_T, a);
@@ -318,11 +320,9 @@ bool World::ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB)
Fixture *a = (Fixture *)Memoizer::find(fixtureA);
if (!a)
throw love::Exception("A fixture has escaped Memoizer!");
a->retain();
Fixture *b = (Fixture *)Memoizer::find(fixtureB);
if (!b)
throw love::Exception("A fixture has escaped Memoizer!");
b->retain();
return filter.process(a, b);
}