Fixed objects which store Lua callback functions to avoid attempting to use dead coroutines when deleting the reference to the callback function. Should fix crashes when coroutines are mixed with those objects.

Also improved the performance of World:rayCast and World:queryBoundingBox.
This commit is contained in:
Alex Szpakowski
2015-07-18 03:26:07 -03:00
parent 64b9d40f00
commit 2cce18946d
14 changed files with 139 additions and 122 deletions
+1 -9
View File
@@ -227,15 +227,7 @@ int Fixture::setUserData(lua_State *L)
{
love::luax_assert_argc(L, 1, 1);
if (data->ref != nullptr)
{
// We set the Reference's lua_State to this one before deleting it, so
// it unrefs using the current lua_State's stack. This is necessary
// if setUserData is called in a coroutine.
data->ref->setL(L);
delete data->ref;
}
delete data->ref;
data->ref = new Reference(L);
return 0;