aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-07-29 08:02:02 -0700
committerChris Robinson <[email protected]>2016-07-29 08:02:02 -0700
commit96e83f95eef5be8e1f64a1a2e61810cb7b82ff5c (patch)
treec36d687b406fef5b64f9f881c59d15aeec73aae7
parent5e11a738c6b18a367070450ec46dfb714fe433d7 (diff)
Don't try freeing the context in ReleaseThreadCtx
Unfortunately on certain systems, the TLS callback is called in a restricted context, and isn't allowed to access certain messaging sub-systems. Such sub- systems may be used if the thread's context is freed, in turn freeing the device, which it tries to close. Ideally, the app shouldn't have tried to destroy a context while it was still current on a thread, or even leave a context current on a thread that's being destroyed,. So for now, release the context ref and print an ERR that it might be leaked.
-rw-r--r--Alc/ALc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 9d3553c8..b6192317 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2376,23 +2376,23 @@ static void ReleaseContext(ALCcontext *context, ALCdevice *device)
void ALCcontext_IncRef(ALCcontext *context)
{
- uint ref;
- ref = IncrementRef(&context->ref);
+ uint ref = IncrementRef(&context->ref);
TRACEREF("%p increasing refcount to %u\n", context, ref);
}
void ALCcontext_DecRef(ALCcontext *context)
{
- uint ref;
- ref = DecrementRef(&context->ref);
+ uint ref = DecrementRef(&context->ref);
TRACEREF("%p decreasing refcount to %u\n", context, ref);
if(ref == 0) FreeContext(context);
}
static void ReleaseThreadCtx(void *ptr)
{
- WARN("%p current for thread being destroyed\n", ptr);
- ALCcontext_DecRef(ptr);
+ ALCcontext *context = ptr;
+ uint ref = DecrementRef(&context->ref);
+ TRACEREF("%p decreasing refcount to %u\n", context, ref);
+ ERR("Context %p current for thread being destroyed, possible leak!\n", context);
}
/* VerifyContext