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

Commit c281b56

Browse files
committed
[WEEX-506][Android] try fix report defaultUrl in mutilThread case
1 parent 5ca1f00 commit c281b56

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,6 @@ private void destroyView(View rootView) {
13421342

13431343
public synchronized void destroy() {
13441344
if(!isDestroy()) {
1345-
WXSDKManager.getInstance().getAllInstanceMap().remove(mInstanceId);
13461345
if(mRendered) {
13471346
WXSDKManager.getInstance().destroyInstance(mInstanceId);
13481347
}
@@ -1400,6 +1399,16 @@ public void run() {
14001399
inactiveAddElementAction.clear();
14011400
}
14021401
});
1402+
1403+
//when report error in @WXExceptionUtils
1404+
// instance may had destroy and remove,
1405+
// so we delay remove from allInstanceMap
1406+
WXBridgeManager.getInstance().postDelay(new Runnable() {
1407+
@Override
1408+
public void run() {
1409+
WXSDKManager.getInstance().getAllInstanceMap().remove(mInstanceId);
1410+
}
1411+
},5000);
14031412
}
14041413
}
14051414

android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@ public void post(Runnable r, Object token) {
396396
m.sendToTarget();
397397
}
398398

399+
public void postDelay(Runnable r,long delayMillis){
400+
if (mJSHandler == null) {
401+
return;
402+
}
403+
mJSHandler.postDelayed(WXThread.secure(r),delayMillis);
404+
}
405+
399406
void setTimeout(String callbackId, String time) {
400407
Message message = Message.obtain();
401408
message.what = WXJSBridgeMsgType.SET_TIMEOUT;

0 commit comments

Comments
 (0)