kill bridge only after cleaning up NativeModules

Reviewed By: javache

Differential Revision: D4734634

fbshipit-source-id: c2d425485679454397d18b1a0c389714c0e3c484
This commit is contained in:
Aaron Chiu 2017-03-19 13:16:04 -07:00 committed by Facebook Github Bot
parent cbd46aaa7c
commit 5328d952a8
2 changed files with 7 additions and 2 deletions

View File

@ -292,11 +292,11 @@ public class CatalystInstanceImpl implements CatalystInstance {
// TODO: tell all APIs to shut down // TODO: tell all APIs to shut down
mDestroyed = true; mDestroyed = true;
mHybridData.resetNative();
mReactQueueConfiguration.getNativeModulesQueueThread().runOnQueue(new Runnable() { mReactQueueConfiguration.getNativeModulesQueueThread().runOnQueue(new Runnable() {
@Override @Override
public void run() { public void run() {
mJavaRegistry.notifyJSInstanceDestroy(); mJavaRegistry.notifyJSInstanceDestroy();
mHybridData.resetNative();
} }
}); });
boolean wasIdle = (mPendingJSCalls.getAndSet(0) == 0); boolean wasIdle = (mPendingJSCalls.getAndSet(0) == 0);

View File

@ -171,7 +171,12 @@ public class EventDispatcher implements LifecycleEventListener {
} }
public void onCatalystInstanceDestroyed() { public void onCatalystInstanceDestroyed() {
stopFrameCallback(); UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
stopFrameCallback();
}
});
} }
private void stopFrameCallback() { private void stopFrameCallback() {