From 07a4801f3b5bfd4fba9a1a4a542ce2f2eae4396a Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> Date: Tue, 5 Aug 2014 23:01:28 +0200 Subject: Bug 1039 - Specify behavior of GLEventListener Exceptions occurring while GLAutoDrawable processing [part-2] In case of an exception thrown within an GLEventListener called off-thread by Animator: - Animator shall stop - Animator shall forward the exception GLDrawableHelper shall also flush all queued GLRunnable tasks in case of an exception, so that another thread waiting until it's completion is notified and continues processing. --- src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 6462b801b..945ca5479 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -551,6 +551,7 @@ public class GLDrawableHelper { } } if( null != firstCaught ) { + flushGLRunnables(); throw GLException.newGLException(firstCaught); } return disposeCount; @@ -658,7 +659,7 @@ public class GLDrawableHelper { init( listener, drawable, sendReshape, 0==i /* setViewport */); } } else { - // Expose same GL initialization if not using GLEventListener + // Expose same GL initialization if not using any GLEventListener drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } } @@ -1067,6 +1068,7 @@ public class GLDrawableHelper { try { forceNativeRelease(context); } catch (final Throwable ex) { + flushGLRunnables(); throw GLException.newGLException(ex); } } @@ -1193,11 +1195,12 @@ public class GLDrawableHelper { } else { forceNativeRelease(context); } - flushGLRunnables(); } catch (final Throwable t) { GLException.dumpThrowable(t); contextCloseCaught = t; } + flushGLRunnables(); // always flush GLRunnables at dispose + if (lastContext != null) { final int res2 = lastContext.makeCurrent(); if (null != lastInitAction && res2 == GLContext.CONTEXT_CURRENT_NEW) { @@ -1307,9 +1310,11 @@ public class GLDrawableHelper { } } if( null != glEventListenerCaught ) { + flushGLRunnables(); throw GLException.newGLException(glEventListenerCaught); } if( null != contextReleaseCaught ) { + flushGLRunnables(); throw GLException.newGLException(contextReleaseCaught); } } @@ -1426,9 +1431,11 @@ public class GLDrawableHelper { } } if( null != glEventListenerCaught ) { + flushGLRunnables(); throw GLException.newGLException(glEventListenerCaught); } if( null != contextReleaseCaught ) { + flushGLRunnables(); throw GLException.newGLException(contextReleaseCaught); } } -- cgit v1.2.3