summaryrefslogtreecommitdiffstats
path: root/core/java/android/animation
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2011-07-29 15:16:19 -0500
committerMartijn Coenen <maco@google.com>2011-07-29 15:23:00 -0500
commitd45204ba092312630a0e516ea7c247e594ce893b (patch)
treed8305375df1850c587ffbfd80e0c94776d80fadd /core/java/android/animation
parent7c8d19d53cd48b6c748365aa6393eab2e9f09641 (diff)
downloadframeworks_base-d45204ba092312630a0e516ea7c247e594ce893b.zip
frameworks_base-d45204ba092312630a0e516ea7c247e594ce893b.tar.gz
frameworks_base-d45204ba092312630a0e516ea7c247e594ce893b.tar.bz2
Fix ConcurrentModificationException in AnimatorSet.
Would occur if you would start an AnimatorSet for the second time. Change-Id: I8fa0e8ab039e8525acae1564b2e9dec4a0838981
Diffstat (limited to 'core/java/android/animation')
-rw-r--r--core/java/android/animation/AnimatorSet.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/animation/AnimatorSet.java b/core/java/android/animation/AnimatorSet.java
index e6c2a0f..dd9fece 100644
--- a/core/java/android/animation/AnimatorSet.java
+++ b/core/java/android/animation/AnimatorSet.java
@@ -19,6 +19,7 @@ package android.animation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
/**
@@ -445,7 +446,10 @@ public final class AnimatorSet extends Animator {
// First, clear out the old listeners
ArrayList<AnimatorListener> oldListeners = node.animation.getListeners();
if (oldListeners != null && oldListeners.size() > 0) {
- for (AnimatorListener listener : oldListeners) {
+ final ArrayList<AnimatorListener> clonedListeners = new
+ ArrayList<AnimatorListener>(oldListeners);
+
+ for (AnimatorListener listener : clonedListeners) {
if (listener instanceof DependencyListener ||
listener instanceof AnimatorSetListener) {
node.animation.removeListener(listener);