diff options
author | Sven Gothel <[email protected]> | 2013-01-18 03:38:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-01-18 03:38:35 +0100 |
commit | 34687193484b2404d83eebf5d008b71d54e52286 (patch) | |
tree | 5e8d58b86a586f66cf18e281775d8bc6f91d200d /src/jogl/classes/javax/media/opengl/GLContext.java | |
parent | 896a0821b78c9aadf38e0d881922e03849584984 (diff) |
Fix Bug 669: Recursive GLContext makeCurrent()/release()
Culprit:
GLContext's makeCurrent() didn't clear the boolean flag 'unlockContextAndSurface'
in case the context is already current (-> recursion).
Above case was detected within a code block tailed by a finally block,
which acted on mentioned flag, i.e. called lock.unlock() and hence decremented the lock count
even though the method return w/ successful state.
Fixed.
Added debug code:
GLContext.release() debug code (DEBUG | TRACE_SWITCH),
recording stack trace of last release() call, which is dumped in case no current was current.
Added 2 unit tests:
- Simple recursive GLContext makeCurrent()/release() from within GLEventListener's display().
Test also validates lock count and lock ownership.
- GLAutoDrawable display() of another GLAutoDrawable
from within GLEventListener's display(..).
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLContext.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 8cc29f1f2..455f2d70d 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -103,6 +103,7 @@ public abstract class GLContext { public static final boolean DEBUG = Debug.debug("GLContext"); public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true); + public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH; /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ public static final boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true); @@ -414,6 +415,16 @@ public abstract class GLContext { } } + /** Returns a String representation of the {@link #makeCurrent()} result. */ + public static final String makeCurrentResultToString(int res) { + switch(res) { + case CONTEXT_NOT_CURRENT: return "CONTEXT_NOT_CURRENT"; + case CONTEXT_CURRENT: return "CONTEXT_CURRENT"; + case CONTEXT_CURRENT_NEW: return "CONTEXT_NOT_CURRENT"; + default: return "INVALID_VALUE"; + } + } + /** * Sets the thread-local variable returned by {@link #getCurrent} * and has no other side-effects. For use by third parties adding |