Missing retain() calls in get*List functions

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-09-25 12:35:57 -04:00
parent 28c5982d92
commit de908f3354
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -404,6 +404,7 @@ namespace box2d
if (!f) break; if (!f) break;
Fixture * fixture = (Fixture *)Memoizer::find(f); Fixture * fixture = (Fixture *)Memoizer::find(f);
if (!fixture) throw love::Exception("A fixture has escaped Memoizer!"); if (!fixture) throw love::Exception("A fixture has escaped Memoizer!");
fixture->retain();
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)fixture); luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)fixture);
lua_rawseti(L, -2, i); lua_rawseti(L, -2, i);
i++; i++;
+3
View File
@@ -380,6 +380,7 @@ namespace box2d
if (b == groundBody) continue; if (b == groundBody) continue;
Body * body = (Body *)Memoizer::find(b); Body * body = (Body *)Memoizer::find(b);
if (!body) throw love::Exception("A body has escaped Memoizer!"); if (!body) throw love::Exception("A body has escaped Memoizer!");
body->retain();
luax_newtype(L, "Body", PHYSICS_BODY_T, (void*)body); luax_newtype(L, "Body", PHYSICS_BODY_T, (void*)body);
lua_rawseti(L, -2, i); lua_rawseti(L, -2, i);
i++; i++;
@@ -396,6 +397,7 @@ namespace box2d
if (!j) break; if (!j) break;
Joint * joint = (Joint *)Memoizer::find(j); Joint * joint = (Joint *)Memoizer::find(j);
if (!joint) throw love::Exception("A joint has escaped Memoizer!"); if (!joint) throw love::Exception("A joint has escaped Memoizer!");
joint->retain();
luax_newtype(L, "Joint", PHYSICS_JOINT_T, (void*)joint); luax_newtype(L, "Joint", PHYSICS_JOINT_T, (void*)joint);
lua_rawseti(L, -2, i); lua_rawseti(L, -2, i);
i++; i++;
@@ -412,6 +414,7 @@ namespace box2d
if (!c) break; if (!c) break;
Contact * contact = (Contact *)Memoizer::find(c); Contact * contact = (Contact *)Memoizer::find(c);
if (!contact) throw love::Exception("A contact has escaped Memoizer!"); if (!contact) throw love::Exception("A contact has escaped Memoizer!");
contact->retain();
luax_newtype(L, "Contact", PHYSICS_CONTACT_T, (void*)contact); luax_newtype(L, "Contact", PHYSICS_CONTACT_T, (void*)contact);
lua_rawseti(L, -2, i); lua_rawseti(L, -2, i);
i++; i++;