summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-08-05 23:01:28 +0200
committerSven Gothel <[email protected]>2014-08-05 23:01:28 +0200
commit07a4801f3b5bfd4fba9a1a4a542ce2f2eae4396a (patch)
tree54cf1b8928bbaa547f4dca61d7788135c782d14d /src/jogl/classes/com
parentb66b068b5c1c238ea702ba7e8ea0c8a1c47cfcf1 (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/com')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index ae09d81a4..634e83353 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -132,6 +132,8 @@ public class Animator extends AnimatorBase {
@Override
public void run() {
+ GLException displayCaught = null;
+
try {
synchronized (Animator.this) {
if(DEBUG) {
@@ -158,7 +160,14 @@ public class Animator extends AnimatorBase {
if ( exclusiveContext && !drawablesEmpty && !ectCleared ) {
ectCleared = true;
setDrawablesExclCtxState(false);
- display(); // propagate exclusive change!
+ try {
+ display(); // propagate exclusive change!
+ } catch (final Throwable t) {
+ displayCaught = GLException.newGLException(t);
+ stopIssued = true;
+ isAnimating = false;
+ break; // end pause loop
+ }
}
isAnimating = false;
Animator.this.notifyAll();
@@ -185,7 +194,14 @@ public class Animator extends AnimatorBase {
}
} // sync Animator.this
if (!stopIssued) {
- display();
+ try {
+ display();
+ } catch (final Throwable t) {
+ displayCaught = GLException.newGLException(t);
+ stopIssued = true;
+ isAnimating = false;
+ break; // end animation loop
+ }
}
if (!stopIssued && !runAsFastAsPossible) {
// Avoid swamping the CPU
@@ -201,16 +217,32 @@ public class Animator extends AnimatorBase {
if( exclusiveContext && !drawablesEmpty ) {
setDrawablesExclCtxState(false);
display(); // propagate exclusive change!
+ try {
+ display(); // propagate exclusive change!
+ } catch (final Throwable t) {
+ if( null == displayCaught ) {
+ displayCaught = GLException.newGLException(t);
+ } else {
+ GLException.newGLException(t).printStackTrace();
+ }
+ }
}
synchronized (Animator.this) {
if(DEBUG) {
System.err.println("Animator stop on " + animThread.getName() + ": " + toString());
+ if( null != displayCaught ) {
+ System.err.println("Animator caught: "+displayCaught.getMessage());
+ displayCaught.printStackTrace();
+ }
}
stopIssued = false;
pauseIssued = false;
animThread = null;
isAnimating = false;
Animator.this.notifyAll();
+ if( null != displayCaught ) {
+ throw displayCaught;
+ }
}
}
}