diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index 741d4461b..284e2bcc9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java @@ -116,6 +116,9 @@ public class FPSAnimator extends AnimatorBase { } private void startTask() { + if(null != task) { + return; + } long delay = (long) (1000.0f / (float) fps); task = new TimerTask() { public void run() { @@ -161,10 +164,14 @@ public class FPSAnimator extends AnimatorBase { stateSync.lock(); try { shouldRun = false; - task.cancel(); - task = null; - timer.cancel(); - timer = null; + if(null != task) { + task.cancel(); + task = null; + } + if(null != timer) { + timer.cancel(); + timer = null; + } animThread = null; } finally { stateSync.unlock(); @@ -179,8 +186,10 @@ public class FPSAnimator extends AnimatorBase { stateSync.lock(); try { shouldRun = false; - task.cancel(); - task = null; + if(null != task) { + task.cancel(); + task = null; + } animThread = null; } finally { stateSync.unlock(); |