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

[WEEX-506][Android] try fix report defaultUrl in mutilThread case #1331

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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