Browse Source

Prevent race condition in thread:receive (bug #131)

Bart van Strien 14 years ago
parent
commit
cfeb01db42
2 changed files with 2 additions and 1 deletions
  1. 2 0
      src/modules/thread/sdl/Thread.cpp
  2. 0 1
      src/modules/thread/sdl/wrap_Thread.cpp

+ 2 - 0
src/modules/thread/sdl/Thread.cpp

@@ -253,6 +253,8 @@ namespace sdl
 	{
 		lock();
 		ThreadVariant *v = comm->getValue(name);
+		if (v)
+			v->retain();
 		unlock();
 		return v;
 	}

+ 0 - 1
src/modules/thread/sdl/wrap_Thread.cpp

@@ -82,7 +82,6 @@ namespace sdl
 			lua_pushnil(L);
 			return 1;
 		}
-		v->retain();
 		t->clear(name);
 		switch(v->type)
 		{