diff options
author | Sven Gothel <[email protected]> | 2013-06-25 07:04:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-25 07:04:17 +0200 |
commit | cc64ad2b1f7904af4e7bd27e927e0bb331db782b (patch) | |
tree | 3ac2ea6921df21bf86e2219da2ab39b74c6df007 /src/newt/classes/com | |
parent | a584e5dd4b40afec3cc04e1ce4abe3eb2f86e04c (diff) |
NEWT WindowImpl/GLWindow: @ JVM Shutdown, force stop animation thread w/o blocking.
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 345d92bc1..25249cee4 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -34,6 +34,8 @@ package com.jogamp.newt.opengl; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.List; import javax.media.nativewindow.AbstractGraphicsConfiguration; @@ -529,6 +531,24 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind savedAnimator.resume(); } } + + @SuppressWarnings("deprecation") + @Override + public void shutdownRenderingAction() { + final GLAnimatorControl anim = GLWindow.this.getAnimator(); + if ( null != anim && anim.isAnimating() ) { + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + final Thread animThread = anim.getThread(); + if( null != animThread ) { + try { + animThread.stop(); + } catch(Throwable t) { } + } + return null; + } } ); + } + } } //---------------------------------------------------------------------- |