Permalink
Browse files

Merge pull request #128 from nazgee/for-nicolas-runnables-skipping

Fix for concurrent modification problem when adding Runnables to a RunnableHandler while the Runnables are being ran.
  • Loading branch information...
2 parents e6df5e8 + 4ee68dc commit 72db5f16afd5160f6a356454fdb85af4bb392863 Nicolas Gramlich committed Jul 11, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/org/andengine/engine/handler/runnable/RunnableHandler.java
@@ -39,9 +39,8 @@ public synchronized void onUpdate(final float pSecondsElapsed) {
final ArrayList<Runnable> runnables = this.mRunnables;
final int runnableCount = runnables.size();
for(int i = runnableCount - 1; i >= 0; i--) {
- runnables.get(i).run();
+ runnables.remove(i).run();
}
- runnables.clear();
}
@Override

0 comments on commit 72db5f1

Please sign in to comment.