From 6e2e650ec9a936f46a1f02dada9f95a4d3245e01 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 3 Mar 2011 22:08:28 -0800 Subject: [PATCH] Set the right context when a stream is being stopped --- src/streamplay.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/streamplay.cpp b/src/streamplay.cpp index c9e7ca8..dd932b8 100644 --- a/src/streamplay.cpp +++ b/src/streamplay.cpp @@ -241,6 +241,10 @@ void StopStream(alureStream *stream) { if(i->stream == stream) { + ALCcontext *old_ctx = (alcGetThreadContext ? + alcGetThreadContext() : NULL); + if(alcSetThreadContext) alcSetThreadContext(i->ctx); + AsyncPlayEntry ent(*i); AsyncPlayList.erase(i); @@ -251,6 +255,12 @@ void StopStream(alureStream *stream) if(ent.eos_callback) ent.eos_callback(ent.user_data, ent.source); + + if(alcSetThreadContext) + { + if(alcSetThreadContext(old_ctx) == ALC_FALSE) + alcSetThreadContext(NULL); + } break; } i++; -- 2.11.4.GIT