mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
oops
This commit is contained in:
@@ -195,13 +195,16 @@ int w_ImageData_mapPixel(lua_State *L)
|
|||||||
ImageData *t = luax_checkimagedata(L, 1);
|
ImageData *t = luax_checkimagedata(L, 1);
|
||||||
luaL_checktype(L, 2, LUA_TFUNCTION);
|
luaL_checktype(L, 2, LUA_TFUNCTION);
|
||||||
|
|
||||||
|
love::thread::Mutex *mutex = t->getMutex();
|
||||||
|
|
||||||
lua_pushcfunction(L, w_ImageData_mapPixelUnsafe);
|
lua_pushcfunction(L, w_ImageData_mapPixelUnsafe);
|
||||||
lua_pushvalue(L, 1);
|
lua_pushvalue(L, 1);
|
||||||
lua_pushvalue(L, 2);
|
lua_pushvalue(L, 2);
|
||||||
|
|
||||||
// Manually lock this ImageData's mutex during the entire mapPixel.
|
// Manually lock this ImageData's mutex during the entire mapPixel.
|
||||||
love::thread::Lock lock(t->getMutex());
|
mutex->lock();
|
||||||
int ret = lua_pcall(L, 2, 0, 0);
|
int ret = lua_pcall(L, 2, 0, 0);
|
||||||
|
mutex->unlock();
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return lua_error(L);
|
return lua_error(L);
|
||||||
|
|||||||
Reference in New Issue
Block a user