From f96efda203f1ebf79c84b3445efdd824537d6e2e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 11 Nov 2012 08:54:56 +0100 Subject: GLDrawableHelper disposeAllGLEventListener(): Don't use cached listener size / check size() > 0, since List can be modified by listener itself --- src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3