mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert D16589168: [RN][TurboModule] Delete jsi::Functions before jsi::Runtime gets deleted
Differential Revision: D16589168 Original commit changeset: a1c0786999c2 fbshipit-source-id: 8048d62e958c0b58aface00dae8447b8c2d5d2dc
This commit is contained in:
committed by
Facebook Github Bot
parent
2198203ddb
commit
6bc0c108eb
@@ -359,40 +359,24 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
listener.onBridgeDestroyed();
|
||||
}
|
||||
}
|
||||
AsyncTask.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Kill non-UI threads from neutral third party
|
||||
// potentially expensive, so don't run on UI thread
|
||||
|
||||
final JSIModule turboModuleManager =
|
||||
mJSIModuleRegistry.getModule(JSIModuleType.TurboModuleManager);
|
||||
// contextHolder is used as a lock to guard against other users of the JS VM
|
||||
// having
|
||||
// the VM destroyed underneath them, so notify them before we resetNative
|
||||
mJavaScriptContextHolder.clear();
|
||||
|
||||
mReactQueueConfiguration
|
||||
.getJSQueueThread()
|
||||
.runOnQueue(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// We need to destroy the TurboModuleManager on the JS Thread
|
||||
turboModuleManager.onCatalystInstanceDestroy();
|
||||
|
||||
AsyncTask.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Kill non-UI threads from neutral third party
|
||||
// potentially expensive, so don't run on UI thread
|
||||
|
||||
// contextHolder is used as a lock to guard against other users of
|
||||
// the JS VM having the VM destroyed underneath them, so notify
|
||||
// them before we resetNative
|
||||
mJavaScriptContextHolder.clear();
|
||||
|
||||
mHybridData.resetNative();
|
||||
getReactQueueConfiguration().destroy();
|
||||
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end");
|
||||
ReactMarker.logMarker(
|
||||
ReactMarkerConstants.DESTROY_CATALYST_INSTANCE_END);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
mHybridData.resetNative();
|
||||
getReactQueueConfiguration().destroy();
|
||||
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end");
|
||||
ReactMarker.logMarker(ReactMarkerConstants.DESTROY_CATALYST_INSTANCE_END);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -32,15 +32,7 @@ public class JSIModuleRegistry {
|
||||
}
|
||||
|
||||
public void notifyJSInstanceDestroy() {
|
||||
for (Map.Entry<JSIModuleType, JSIModuleHolder> entry : mModules.entrySet()) {
|
||||
JSIModuleType moduleType = entry.getKey();
|
||||
|
||||
// Don't call TurboModuleManager.onCatalystInstanceDestroy
|
||||
if (moduleType == JSIModuleType.TurboModuleManager) {
|
||||
continue;
|
||||
}
|
||||
|
||||
JSIModuleHolder moduleHolder = entry.getValue();
|
||||
for (JSIModuleHolder moduleHolder : mModules.values()) {
|
||||
moduleHolder.notifyJSInstanceDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user