From 24e704e1b94c5f020678c6dc26ab5f437e962dbf Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 24 Dec 2021 15:29:37 +0800 Subject: [PATCH] android: fix cancel cause modify map concurrently --- .../doric/src/main/java/pub/doric/DoricContext.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/DoricContext.java b/doric-android/doric/src/main/java/pub/doric/DoricContext.java index 6e548fac..82252cd0 100644 --- a/doric-android/doric/src/main/java/pub/doric/DoricContext.java +++ b/doric-android/doric/src/main/java/pub/doric/DoricContext.java @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.Callable; @@ -190,10 +191,13 @@ public class DoricContext { } public void teardown() { - for (Animator animator : animators.values()) { - animator.cancel(); + Set animatorIds = animators.keySet(); + for (String animatorId : animatorIds) { + Animator animator = animators.remove(animatorId); + if (animator != null) { + animator.cancel(); + } } - animators.clear(); callEntity(DoricConstant.DORIC_ENTITY_DESTROY).setCallback(new AsyncResult.Callback() { @Override public void onResult(JSDecoder result) {