From 424066616b085b36d88a39d56a618ea57cebc9e9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 13 Sep 2014 15:27:43 +0200 Subject: AnimatorBase.finishLifecycleAction(): Non blocking call shall return true, success - otherwise pause()/.. return value is inconsistent. Caller of e.g. pause() running on the anim-thread or AWT-EDT (AWTAnimatorImpl) will be non-blocking. Before this change, a non-blocking simply did not wait until the 'hold' condition is reached and returned its negated value. This ofc is 'false', indicated unsuccessful operation. Caller use the return value to determine whether the call actually paused (or ..) the animator. Despite the non-blocking nature, the pause state was set, even if not reached. Hence a resume() would be required to continue operation after a temporary pause. +++ This change ignores the non-blocking nature's unmet condition. finishLifecycleAction() returns !nok || !blocking, i.e. either true for the reached condition (blocking) or true if non-blocking. Blocking calls with unmet condition still return false. +++ In case an animated GLAutoDrawableis being pulled after a non-blocking animator pause() call, the GLAutoDrawable's implementation thread-safety must ensure proper operation. +++ --- src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/javax/media/opengl') diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 78310c654..3b24cc2af 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -471,10 +471,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } if (backend != null && backend.getContext() != null) { - boolean animatorPaused = false; + final boolean animatorPaused; final GLAnimatorControl animator = getAnimator(); if(null!=animator) { animatorPaused = animator.pause(); + } else { + animatorPaused = false; } if(backend.getContext().isCreated()) { @@ -486,7 +488,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing isInitialized = false; } - if(animatorPaused) { + if( animatorPaused ) { animator.resume(); } } -- cgit v1.2.3