summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llaudio/llaudioengine_openal.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp
index 4126c8ef80..7dde7fd15d 100644
--- a/indra/llaudio/llaudioengine_openal.cpp
+++ b/indra/llaudio/llaudioengine_openal.cpp
@@ -228,7 +228,7 @@ void LLAudioEngine_OpenAL::shutdown()
{
LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL;
- if (mHasSystemEventsExt && mEventControlSOFT && mEventCallbackSOFT)
+ if (mHasReopenExt && mHasSystemEventsExt && mEventControlSOFT && mEventCallbackSOFT)
{
ALCenum events[] = { ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT };
mEventControlSOFT(1, events, ALC_FALSE);
@@ -247,6 +247,24 @@ void LLAudioEngine_OpenAL::shutdown()
<< alutGetErrorString(error) << LL_ENDL;
}
+ // Mac OS' alutExit can trip over stale error state. Drain it.
+ if (alcGetCurrentContext() != NULL)
+ {
+ // Avoid potential infinite loops.
+ for (int i = 0; i < 16; ++i)
+ {
+ if (alGetError() == AL_NO_ERROR)
+ {
+ break;
+ }
+ }
+ ALenum error = alGetError();
+ if (error != AL_NO_ERROR)
+ {
+ LL_WARNS() << "Uncleared error state prior to shutdown: " << error << LL_ENDL;
+ }
+ }
+
LL_INFOS() << "About to alutExit()" << LL_ENDL;
if(!alutExit())
{