diff options
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index f7f846b05..1a18b3432 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -408,7 +408,7 @@ public class GLDrawableHelper { int disposeCount = 0; synchronized(listenersLock) { if( remove ) { - for (int count = listeners.size(); 0 < count; count--) { + for (int count = listeners.size(); 0 < count && 0 < listeners.size(); count--) { final GLEventListener listener = listeners.remove(0); if( !listenersToBeInit.remove(listener) ) { listener.dispose(autoDrawable); @@ -416,8 +416,7 @@ public class GLDrawableHelper { } } } else { - final int count = listeners.size(); - for (int i = 0; i < count; i++) { + for (int i = 0; i < listeners.size(); i++) { final GLEventListener listener = listeners.get(i); if( !listenersToBeInit.contains(listener) ) { listener.dispose(autoDrawable); |