From c8f7884cad992d327f6acab4d5373c86a1077547 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 5 Jul 2013 02:36:19 +0200 Subject: GLWindow.shutdownRenderingAction: If on anim thread, simply stop ourselves (non-blocking) --- .../classes/com/jogamp/newt/opengl/GLWindow.java | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/newt/classes/com') 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() { - 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() { + public Object run() { + if( anim.isAnimating() && null != animThread ) { + try { + animThread.stop(); + } catch(Throwable t) { + } + } + return null; + } } ); + } } } } -- cgit v1.2.3