Browse Source

Prevent infinite loop when destroying sources (issue #250)

Bart van Strien 14 years ago
parent
commit
caf46ad430
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/modules/audio/openal/Pool.cpp
  2. 2 1
      src/modules/audio/openal/Source.cpp

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

@@ -271,9 +271,9 @@ namespace openal
 		if(i != playing.end())
 		{
 			source->stopAtomic();
-			source->release();
 			available.push(i->second);
 			playing.erase(i++);
+			source->release();
 			return true;
 		}
 

+ 2 - 1
src/modules/audio/openal/Source.cpp

@@ -65,7 +65,8 @@ namespace openal
 
 	Source::~Source()
 	{
-		pool->stop(this);
+		if (valid)
+			pool->stop(this);
 		alDeleteBuffers((type == TYPE_STATIC) ? 1 : MAX_BUFFERS, buffers);
 		if (decoder)
 			decoder->release();