Kaynağa Gözat

Fixed race condition in Source:play (thanks Boolsheet)

Alex Szpakowski 12 yıl önce
ebeveyn
işleme
f7ca9ef557
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3 3
      src/modules/audio/openal/Pool.cpp

+ 3 - 3
src/modules/audio/openal/Pool.cpp

@@ -118,11 +118,11 @@ int Pool::getMaxSources() const
 
 
 bool Pool::play(Source *source, ALuint &out)
 bool Pool::play(Source *source, ALuint &out)
 {
 {
-	bool ok;
-	out = 0;
-
 	thread::Lock lock(mutex);
 	thread::Lock lock(mutex);
 
 
+	bool ok = true;
+	out = 0;
+
 	bool alreadyPlaying = findSource(source, out);
 	bool alreadyPlaying = findSource(source, out);
 
 
 	if (!alreadyPlaying)
 	if (!alreadyPlaying)