diff options
author | Sven Gothel <[email protected]> | 2014-08-05 23:01:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-08-05 23:01:28 +0200 |
commit | 07a4801f3b5bfd4fba9a1a4a542ce2f2eae4396a (patch) | |
tree | 54cf1b8928bbaa547f4dca61d7788135c782d14d /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | |
parent | b66b068b5c1c238ea702ba7e8ea0c8a1c47cfcf1 (diff) |
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.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 11 |
1 files changed, 9 insertions, 2 deletions
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); } } |