aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-08-06 05:59:08 +0200
committerSven Gothel <[email protected]>2014-08-06 05:59:08 +0200
commit88eef9e4eae8e63762252f1d11bca2bd0fde809b (patch)
tree1a70cb2f54ada3a654928ec30432d5fca6ef822e /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
parent07a4801f3b5bfd4fba9a1a4a542ce2f2eae4396a (diff)
Bug 1039 - Specify behavior of GLEventListener Exceptions occurring while GLAutoDrawable processing [part-3]
Add GLAnimatorControl.UncaughtGLAnimatorExceptionHandler interface to optionally handle uncaught exception within an animator thread by the user. Implementation also requires to flush all enqueued GLRunnable instances via GLAutoDrawable.invoked(..) in case such exception occurs. Hence 'GLAutoDrawable.flushGLRunnables()' has been added. Only subsequent exceptions, which cannot be thrown are dumped to System.stderr. +++ Handling of exceptions during dispose() Exception in NEWT's disposeGL*() are also caught and re-thrown after the NEWT window has been destroyed in WindowImpl.destroyAction: - GLEventListener.dispose(..) - GLDrawableHelper.disposeAllGLEventListener(..) - GLDrawableHelper.disposeGL(..) - GLAutoDrawableBase.destroyImplInLock(..) - GLWindow.GLLifecycleHook.destroyActionInLock(..) - WindowImpl.destroyAction on NEWT-EDT - WindowImpl.destroy Further more, exceptions occuring in native windowing toolkit triggered destroy() are ignored: - GLAutoDrawableBase.defaultWindowDestroyNotifyOp(..) It has to be seen whether such exception handling for dispose() shall be added to AWT/SWT. +++ TestGLException01NEWT covers all GLEventListener exception cases on-thread and off-thread (via animator). +++
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 945ca5479..f91e1bdba 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -526,8 +526,9 @@ public class GLDrawableHelper {
} catch (final Throwable t) {
if( null == firstCaught ) {
firstCaught = t;
+ } else {
+ GLException.dumpThrowable("subsequent", t);
}
- GLException.dumpThrowable(t);
}
disposeCount++;
}
@@ -541,8 +542,9 @@ public class GLDrawableHelper {
} catch (final Throwable t) {
if( null == firstCaught ) {
firstCaught = t;
+ } else {
+ GLException.dumpThrowable("subsequent", t);
}
- GLException.dumpThrowable(t);
}
listenersToBeInit.add(listener);
disposeCount++;
@@ -1125,8 +1127,7 @@ public class GLDrawableHelper {
final Runnable initAction) {
if(null==context) {
if (DEBUG) {
- final Exception e = new GLException("Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext");
- GLException.dumpThrowable(e);
+ GLException.dumpThrowable("informal", new GLException("Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"));
}
return;
}
@@ -1196,7 +1197,6 @@ public class GLDrawableHelper {
forceNativeRelease(context);
}
} catch (final Throwable t) {
- GLException.dumpThrowable(t);
contextCloseCaught = t;
}
flushGLRunnables(); // always flush GLRunnables at dispose
@@ -1208,6 +1208,9 @@ public class GLDrawableHelper {
}
}
if( null != disposeCaught ) {
+ if( null != contextCloseCaught ) {
+ GLException.dumpThrowable("subsequent", contextCloseCaught);
+ }
throw disposeCaught;
}
if( null != contextCloseCaught ) {
@@ -1283,7 +1286,6 @@ public class GLDrawableHelper {
drawable.swapBuffers();
}
} catch (final Throwable t) {
- GLException.dumpThrowable(t);
glEventListenerCaught = t;
} finally {
if( _releaseExclusiveThread ) {
@@ -1296,7 +1298,6 @@ public class GLDrawableHelper {
try {
context.release();
} catch (final Throwable t) {
- GLException.dumpThrowable(t);
contextReleaseCaught = t;
}
}
@@ -1311,6 +1312,9 @@ public class GLDrawableHelper {
}
if( null != glEventListenerCaught ) {
flushGLRunnables();
+ if( null != contextReleaseCaught ) {
+ GLException.dumpThrowable("subsequent", contextReleaseCaught);
+ }
throw GLException.newGLException(glEventListenerCaught);
}
if( null != contextReleaseCaught ) {
@@ -1401,7 +1405,6 @@ public class GLDrawableHelper {
tdS = tdX - tdS; // swapBuffers
}
} catch (final Throwable t) {
- GLException.dumpThrowable(t);
glEventListenerCaught = t;
} finally {
if( _releaseExclusiveThread ) {
@@ -1416,7 +1419,6 @@ public class GLDrawableHelper {
context.release();
ctxReleased = true;
} catch (final Throwable t) {
- GLException.dumpThrowable(t);
contextReleaseCaught = t;
}
}
@@ -1432,6 +1434,9 @@ public class GLDrawableHelper {
}
if( null != glEventListenerCaught ) {
flushGLRunnables();
+ if( null != contextReleaseCaught ) {
+ GLException.dumpThrowable("subsequent", contextReleaseCaught);
+ }
throw GLException.newGLException(glEventListenerCaught);
}
if( null != contextReleaseCaught ) {