diff --git a/src/modules/thread/sdl/Thread.cpp b/src/modules/thread/sdl/Thread.cpp index a569ca3f0..219adc4dd 100644 --- a/src/modules/thread/sdl/Thread.cpp +++ b/src/modules/thread/sdl/Thread.cpp @@ -270,6 +270,7 @@ namespace sdl SDL_CondWait(cond, mutex); v = comm->getValue(name); } + v->retain(); unlock(); return v; } diff --git a/src/modules/thread/sdl/wrap_Thread.cpp b/src/modules/thread/sdl/wrap_Thread.cpp index 9a2a79f44..dd6dcc88f 100644 --- a/src/modules/thread/sdl/wrap_Thread.cpp +++ b/src/modules/thread/sdl/wrap_Thread.cpp @@ -109,7 +109,9 @@ namespace sdl lua_pushnil(L); break; } + t->lock(); v->release(); + t->unlock(); return 1; } @@ -123,7 +125,6 @@ namespace sdl lua_pushnil(L); return 1; } - v->retain(); t->clear(name); switch(v->type) { @@ -151,7 +152,9 @@ namespace sdl lua_pushnil(L); break; } + t->lock(); v->release(); + t->unlock(); return 1; } @@ -165,7 +168,6 @@ namespace sdl lua_pushnil(L); return 1; } - v->retain(); switch(v->type) { case BOOLEAN: @@ -192,7 +194,9 @@ namespace sdl lua_pushnil(L); break; } + t->lock(); v->release(); + t->unlock(); return 1; }