Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[WEEX-506][Android] try fix report defaultUrl in mutilThread case
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky-chen committed Jul 16, 2018
1 parent 5ca1f00 commit c281b56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,6 @@ private void destroyView(View rootView) {

public synchronized void destroy() {
if(!isDestroy()) {
WXSDKManager.getInstance().getAllInstanceMap().remove(mInstanceId);
if(mRendered) {
WXSDKManager.getInstance().destroyInstance(mInstanceId);
}
Expand Down Expand Up @@ -1400,6 +1399,16 @@ public void run() {
inactiveAddElementAction.clear();
}
});

//when report error in @WXExceptionUtils
// instance may had destroy and remove,
// so we delay remove from allInstanceMap
WXBridgeManager.getInstance().postDelay(new Runnable() {
@Override
public void run() {
WXSDKManager.getInstance().getAllInstanceMap().remove(mInstanceId);
}
},5000);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,13 @@ public void post(Runnable r, Object token) {
m.sendToTarget();
}

public void postDelay(Runnable r,long delayMillis){
if (mJSHandler == null) {
return;
}
mJSHandler.postDelayed(WXThread.secure(r),delayMillis);
}

void setTimeout(String callbackId, String time) {
Message message = Message.obtain();
message.what = WXJSBridgeMsgType.SET_TIMEOUT;
Expand Down

0 comments on commit c281b56

Please sign in to comment.