diff options
-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; + } } ); + } } } } |