diff options
author | Sven Gothel <[email protected]> | 2012-01-13 11:43:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-01-13 11:43:35 +0100 |
commit | d23b08203e32f8f50991a48132eb3c2236b4efc0 (patch) | |
tree | 3d2936474900284fc576000c777099caa4d1bc88 /src/jogl/classes/jogamp/opengl/GLContextImpl.java | |
parent | 835b36d626f75f9e96001a41c2a6fe9f90466ae1 (diff) |
OSX Fix: Catch releaseImpl's glFinish() exception (DebugGL); Make GLContext.release's setCurrent(null) exception prone.
Catch releaseImpl's glFinish() exception (DebugGL)
glGetError() after glFinish() (eg. w/ debug pipeline) produced unknown error 0x0506
on OS X (10.7.2 NV).
Make GLContext.release's setCurrent(null) exception prone
Call setCurrent(null) in finalizer block to ensure it's 'released' out of the TLS
even when an exception is being thrown.
Make MacOSX Shared Resources 'destroy' more error prone (catch exceptions)
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index e87d283eb..a7710e5bc 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -67,8 +67,6 @@ import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GLProfile; public abstract class GLContextImpl extends GLContext { - public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true); - /** * Context full qualified name: display_type + display_connection + major + minor + ctp. * This is the key for all cached GL ProcAddressTables, etc, to support multi display/device setups. @@ -242,18 +240,24 @@ public abstract class GLContextImpl extends GLContext { release(false); } private void release(boolean force) throws GLException { + if(TRACE_SWITCH) { + System.err.println("GLContext.ContextSwitch: - release() - "+Thread.currentThread().getName()+": force: "+force+", "+lock); + } if ( !lock.isOwner() ) { - throw new GLException("Context not current on current thread"); + throw new GLException("Context not current on current thread "+Thread.currentThread().getName()+": "+this); } final boolean actualRelease = force || lock.getHoldCount() == 1 ; - try { + try { if( actualRelease ) { - setCurrent(null); if (contextHandle != 0) { // allow dbl-release releaseImpl(); } } } finally { + // exception prone .. + if( actualRelease ) { + setCurrent(null); + } drawable.unlockSurface(); lock.unlock(); if(TRACE_SWITCH) { @@ -276,7 +280,7 @@ public abstract class GLContextImpl extends GLContext { throw new GLException("XXX: "+lock); } if (DEBUG || TRACE_SWITCH) { - System.err.println("GLContextImpl.destroy.0: " + toHexString(contextHandle) + + System.err.println("GLContextImpl.destroy.0 - "+Thread.currentThread().getName()+": " + toHexString(contextHandle) + ", isShared "+GLContextShareSet.isShared(this)+" - "+lock); } if (contextHandle != 0) { |