*[Core] fix page close wonât clean msg in handler.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/413b065b Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/413b065b Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/413b065b Branch: refs/heads/master Commit: 413b065b5aa9988bd14c2afd00903ad6d56f1d30 Parents: 9e1455d Author: 驱影 <jike....@alibaba-inc.com> Authored: Thu Apr 26 11:36:03 2018 +0800 Committer: YorkShen <shenyua...@gmail.com> Committed: Mon May 7 15:52:07 2018 +0800 ---------------------------------------------------------------------- .../src/main/java/com/taobao/weex/ui/WXRenderHandler.java | 3 ++- .../src/main/java/com/taobao/weex/ui/WXRenderManager.java | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/413b065b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderHandler.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderHandler.java b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderHandler.java index 99cba05..2bfb685 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderHandler.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderHandler.java @@ -30,7 +30,8 @@ class WXRenderHandler extends Handler { public final boolean post(String instanceId, Runnable r) { Message msg = Message.obtain(this, r); - msg.obj = instanceId.hashCode(); + // Use what to match runnable. Make sure don't override callback method. + msg.what = instanceId.hashCode(); return sendMessageDelayed(msg, 0); } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/413b065b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java index 143265c..e91fb08 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderManager.java @@ -99,8 +99,12 @@ public class WXRenderManager { if (statement != null) { statement.destroy(); } - final Object token = instanceId == null ? null : instanceId.hashCode(); - mWXRenderHandler.removeCallbacksAndMessages(token); + if(instanceId == null) { + mWXRenderHandler.removeCallbacksAndMessages(null); + } else { + // use hashCode to match message's what. + mWXRenderHandler.removeMessages(instanceId.hashCode()); + } } public void postGraphicAction(final String instanceId, final BasicGraphicAction action) {