From d225d0a8a16e362ddb14cb93c124eb06cf0ff05e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 22 Dec 2011 01:16:12 +0100 Subject: GLJPanel: Fix dispose of backend (J2DOGL thread, no double dispose).., GLJPanel: - fix dispose of backend - proper J2DOGL thread - no double dispose - remove VERBOSE - no dispose regenerate flag - add @Overrride - more safe createContext(..) impl - setSynchronized(true); for all backends - ensure AbstractGraphicsDevice close() is being called GLDrawableHelper: - Clarify w/ isDisposeAction = null==initAction GLPbufferImpl: - ensure AbstractGraphicsDevice close() is being called Java2D: - remove VERBOSE - --- src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java') diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 1453a853c..41b4ea878 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -348,11 +348,10 @@ public class GLDrawableHelper { return; } - if(null==initAction) { - // disposal case - if(!context.isCreated()) { - throw new GLException(Thread.currentThread().getName()+" GLDrawableHelper " + this + ".invokeGL(): Dispose case (no init action given): Native context is not created: "+context); - } + final boolean isDisposeAction = null==initAction ; + + if( isDisposeAction && !context.isCreated() ) { + throw new GLException(Thread.currentThread().getName()+" GLDrawableHelper " + this + ".invokeGL(): Dispose case (no init action given): Native context is not created: "+context); } // Support for recursive makeCurrent() calls as well as calling @@ -383,7 +382,7 @@ public class GLDrawableHelper { res = context.makeCurrent(); } if (res != GLContext.CONTEXT_NOT_CURRENT) { - if(null!=initAction) { + if(!isDisposeAction) { perThreadInitAction.set(initAction); if (res == GLContext.CONTEXT_CURRENT_NEW) { if (DEBUG) { @@ -398,12 +397,10 @@ public class GLDrawableHelper { runnable.run(); // td2 = System.currentTimeMillis(); // tdR = td2 - tdR; // render time - if (autoSwapBufferMode && null != initAction) { - if (drawable != null) { + if (autoSwapBufferMode && !isDisposeAction && drawable != null) { drawable.swapBuffers(); // td3 = System.currentTimeMillis(); // td2 = td3 - td2; // swapBuffers - } } } } -- cgit v1.2.3