diff options
author | Sven Gothel <[email protected]> | 2013-07-05 02:36:19 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-07-05 02:36:19 +0200 |
commit | c8f7884cad992d327f6acab4d5373c86a1077547 (patch) | |
tree | d371327464e57decabfb4836543c6521f085a507 | |
parent | a07d1288b6dc842d02df290e4dbd6479078549a6 (diff) |
GLWindow.shutdownRenderingAction: If on anim thread, simply stop ourselves (non-blocking)
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 25249cee4..286840ed1 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -537,16 +537,21 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind 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; - } } ); + final Thread animThread = anim.getThread(); + if( animThread == Thread.currentThread() ) { + anim.stop(); // on anim thread, non-blocking + } else { + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + if( anim.isAnimating() && null != animThread ) { + try { + animThread.stop(); + } catch(Throwable t) { + } + } + return null; + } } ); + } } } } |