diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-03-15 12:39:53 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-03-15 12:39:53 +0000 |
commit | 8d37864e2cd5f6d878ce44a95bba3b9fcc354098 (patch) | |
tree | 42b1edb31cee4a81929b19f0834621148f24cd24 | |
parent | 39dffd4dcfaa859cdc029b506abf667a5b7be71f (diff) | |
download | ioquake3-aero-8d37864e2cd5f6d878ce44a95bba3b9fcc354098.tar.gz ioquake3-aero-8d37864e2cd5f6d878ce44a95bba3b9fcc354098.zip |
* Fix leaking OpenAL buffers (Amanieu)
git-svn-id: svn://svn.icculus.org/quake3/trunk@1510 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r-- | code/client/snd_openal.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 6b3f547..b8ae488 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -1396,6 +1396,8 @@ S_AL_StreamDie static void S_AL_StreamDie( int stream ) { + int numBuffers; + if ((stream < 0) || (stream >= MAX_RAW_STREAMS)) return; @@ -1404,6 +1406,16 @@ void S_AL_StreamDie( int stream ) streamPlaying[stream] = qfalse; qalSourceStop(streamSources[stream]); + + // Un-queue any buffers, and delete them + qalGetSourcei( streamSources[stream], AL_BUFFERS_PROCESSED, &numBuffers ); + while( numBuffers-- ) + { + ALuint buffer; + qalSourceUnqueueBuffers(streamSources[stream], 1, &buffer); + qalDeleteBuffers(1, &buffer); + } + S_AL_FreeStreamChannel(stream); } |