aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alError.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-04-24 21:41:01 -0700
committerChris Robinson <[email protected]>2012-04-24 21:41:01 -0700
commit58e3dc3d52204d71d0e0402b9308fd675064d87e (patch)
tree25e78005847658d8e56bd6f09ba2a69fbc3fa8f3 /OpenAL32/alError.c
parent3e49e7914013746b70917ada00ac1d2f8903819d (diff)
Add a SIGTRAP for when alGetError is called without a context
Diffstat (limited to 'OpenAL32/alError.c')
-rw-r--r--OpenAL32/alError.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c
index 56f4248e..d18c1867 100644
--- a/OpenAL32/alError.c
+++ b/OpenAL32/alError.c
@@ -28,21 +28,6 @@
ALboolean TrapALError = AL_FALSE;
-AL_API ALenum AL_APIENTRY alGetError(void)
-{
- ALCcontext *Context;
- ALenum errorCode;
-
- Context = GetContextRef();
- if(!Context) return AL_INVALID_OPERATION;
-
- errorCode = ExchangeInt(&Context->LastError, AL_NO_ERROR);
-
- ALCcontext_DecRef(Context);
-
- return errorCode;
-}
-
ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
{
if(TrapALError)
@@ -57,3 +42,30 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
}
CompExchangeInt(&Context->LastError, AL_NO_ERROR, errorCode);
}
+
+AL_API ALenum AL_APIENTRY alGetError(void)
+{
+ ALCcontext *Context;
+ ALenum errorCode;
+
+ Context = GetContextRef();
+ if(!Context)
+ {
+ if(TrapALError)
+ {
+#ifdef _WIN32
+ if(IsDebuggerPresent())
+ DebugBreak();
+#elif defined(SIGTRAP)
+ raise(SIGTRAP);
+#endif
+ }
+ return AL_INVALID_OPERATION;
+ }
+
+ errorCode = ExchangeInt(&Context->LastError, AL_NO_ERROR);
+
+ ALCcontext_DecRef(Context);
+
+ return errorCode;
+}