mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix leak checker crash in bridgeless mode
Summary: Fast follow to D26727461 (https://github.com/facebook/react-native/commit/34d189ae09b32261e1a2055263bd425f8a82a4c6), in bridgeless mode, `_contextContainer` doesn't have bridge, so avoid setting up `garbageCollectionTrigger`. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D27173725 fbshipit-source-id: 5530c43638c17fb03e065c11667786efe9f3ef11
This commit is contained in:
1 parent
cfb5b5e20a
commit
ac7ba3ea16
1 file changed
+10
-7
@@ -291,13 +291,16 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
||||
}
|
||||
|
||||
#ifdef REACT_NATIVE_DEBUG
|
||||
RCTBridge *bridge = (RCTBridge *)unwrapManagedObjectWeakly(_contextContainer->at<std::shared_ptr<void>>("Bridge"));
|
||||
toolbox.garbageCollectionTrigger = [bridge]() {
|
||||
RCTCxxBridge *batchedBridge = (RCTCxxBridge *)([bridge batchedBridge] ?: bridge);
|
||||
if ([batchedBridge respondsToSelector:@selector(forceGarbageCollection)]) {
|
||||
[batchedBridge forceGarbageCollection];
|
||||
}
|
||||
};
|
||||
auto optionalBridge = _contextContainer->find<std::shared_ptr<void>>("Bridge");
|
||||
if (optionalBridge) {
|
||||
RCTBridge *bridge = unwrapManagedObjectWeakly(optionalBridge.value());
|
||||
toolbox.garbageCollectionTrigger = [bridge]() {
|
||||
RCTCxxBridge *batchedBridge = (RCTCxxBridge *)([bridge batchedBridge] ?: bridge);
|
||||
if ([batchedBridge respondsToSelector:@selector(forceGarbageCollection)]) {
|
||||
[batchedBridge forceGarbageCollection];
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
toolbox.synchronousEventBeatFactory = [runtimeExecutor](EventBeat::SharedOwnerBox const &ownerBox) {
|
||||
|
||||
Reference in new issue
Block a user