diff options
author | Sven Gothel <[email protected]> | 2012-11-11 08:54:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-11-11 08:54:56 +0100 |
commit | f96efda203f1ebf79c84b3445efdd824537d6e2e (patch) | |
tree | 7a314474d1e9709ed0c4f5a75a2c4bd7eae4234b /src | |
parent | a2bc4bcf26ce392d892c8cba5071d3f3877ed0c7 (diff) |
GLDrawableHelper disposeAllGLEventListener(): Don't use cached listener size / check size() > 0, since List can be modified by listener itself
Diffstat (limited to 'src')
-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); |