1. Bart van Strien
  2. love-experiments

Commits

Alex Szpakowski  committed e96f507

Fixed race condition in Source:play (thanks Boolsheet)

  • Participants
  • Parent commits b266b14
  • Branches default

Comments (0)

Files changed (1)

File src/modules/audio/openal/Pool.cpp

View file
  • Ignore whitespace
 
 bool Pool::play(Source *source, ALuint &out)
 {
-	bool ok;
+	thread::Lock lock(mutex);
+
+	bool ok = true;
 	out = 0;
 
-	thread::Lock lock(mutex);
-
 	bool alreadyPlaying = findSource(source, out);
 
 	if (!alreadyPlaying)