aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-10 03:13:25 -0700
committerChris Robinson <[email protected]>2011-09-10 03:18:31 -0700
commit238a74741442abb9dbc8144cf2da298eecf45461 (patch)
tree6c186e266dffd9921b1ef91728a08e246ba630b9 /Alc
parentc35433ec7a0a1bad22ddbd347265e296adb700ef (diff)
Warn about contexts that are errantly left current
These won't show by default in release mode, unless the log level is changed to show warnings.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 565755a6..635ad7ee 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1481,6 +1481,7 @@ void ALCcontext_DecRef(ALCcontext *context)
static void ReleaseThreadCtx(void *ptr)
{
+ WARN("Context %p still current for thread being destroyed\n", ptr);
ALCcontext_DecRef(ptr);
}
@@ -2236,8 +2237,18 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context)
}
UnlockDevice(Device);
+ if(pthread_getspecific(LocalContext) == context)
+ {
+ WARN("Context %p destroyed while current on thread\n", context);
+ pthread_setspecific(LocalContext, NULL);
+ ALCcontext_DecRef(context);
+ }
+
if(CompExchangePtr((void**)&GlobalContext, context, NULL))
+ {
+ WARN("Context %p destroyed while globally current\n", context);
ALCcontext_DecRef(context);
+ }
if(Device->NumContexts == 0)
{