diff options
author | Sven Gothel <[email protected]> | 2023-07-09 14:56:00 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-07-09 14:56:00 +0200 |
commit | 38d03bf5056f7938afcac584bc4321eca49076a1 (patch) | |
tree | c46f082ea20764388024a652c99ff3c8b0f7967c /src/java | |
parent | a1312ed74545eff208ed560a0989523a89dde3e9 (diff) |
Sound3d.Context: destroy() shall only 'null' thread-local context if this is current; Expose hasALC_thread_local_context to avoid double checks
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/jogamp/openal/sound3d/Context.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/java/com/jogamp/openal/sound3d/Context.java b/src/java/com/jogamp/openal/sound3d/Context.java index 2884f0c..e42f9dc 100644 --- a/src/java/com/jogamp/openal/sound3d/Context.java +++ b/src/java/com/jogamp/openal/sound3d/Context.java @@ -34,7 +34,6 @@ package com.jogamp.openal.sound3d; -import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.openal.*; @@ -51,7 +50,7 @@ public final class Context { private final Device device; private volatile ALCcontext alCtx; private boolean threadContextLocked; - private boolean hasALC_thread_local_context; + public final boolean hasALC_thread_local_context; private static final ThreadLocal<Context> currentContext = new ThreadLocal<Context>(); /** @@ -64,7 +63,6 @@ public final class Context { this.device = device; this.alCtx = realContext; { - hasALC_thread_local_context = false; final boolean v; if( makeCurrent(false) ) { v = AudioSystem3D.alc.alcIsExtensionPresent(null, ALHelpers.ALC_EXT_thread_local_context) || @@ -165,7 +163,9 @@ public final class Context { lock.lock(); try { destroyImpl(); - currentContext.set(null); + if( currentContext.get() == this ) { + currentContext.set(null); + } // unroll lock ! while(lock.getHoldCount() > 1) { lock.unlock(); |