summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSteve Vaughan <[email protected]>2010-11-19 11:03:02 -0500
committerSteve Vaughan <[email protected]>2010-11-19 11:03:02 -0500
commit5ece52d5d7f4fd815199acd6cb0f4e6f586e8252 (patch)
tree4083f3f7ccafd11ca766f2a925a48ede0041bf7b /src/newt
parentd6750dfe8de1d3606f00ad8263d6060a937f33e5 (diff)
Avoid sendDestroy mechanism in favor of immediate destroy using AnimatorControl to pause rendering.
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 7c0384bd0..dfc2651e7 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -85,11 +85,30 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer {
}
public void windowDestroyNotify(WindowEvent e) {
- if( !GLWindow.this.window.isSurfaceLockedByOtherThread() && !GLWindow.this.helper.isExternalAnimatorAnimating() ) {
+ // Is an animator thread perform rendering?
+ if (GLWindow.this.helper.isExternalAnimatorAnimating()) {
+ // Pause animations before initiating destroy.
+ GLAnimatorControl ctrl = GLWindow.this.helper
+ .getAnimator();
+ ctrl.pause();
+
destroy();
- } else {
+
+ // Resume animations.
+ ctrl.resume();
+ }
+ // Is the surface locked another thread?
+ else if (GLWindow.this.window
+ .isSurfaceLockedByOtherThread()) {
+ // Flag that destroy should be performed on the next
+ // attempt to display.
sendDestroy = true;
}
+ else {
+ // Without an external thread animating or locking the
+ // surface, we should be safe.
+ destroy ();
+ }
}
});
this.window.setLifecycleHook(new GLLifecycleHook());