mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Guard against nil methodQueue in RCTBlobManager
Summary: ## Description In T63516227, we're seeing a crash that occurs because `networking.methodQueue` is `nil`, and we try to `dispatch_async` to it. ## Hypothesis This looks like a problem with NativeModule cleanup: 1. Some JS executes a call to `RCTBlobManager.addNetworkingHander`. This schedules an async method call on the `RCTBlobManager` method queue. 2. In `RCTCxxBridge invalidate`, on the JS thread, we loop through all the `RCTModuleData`s, and invalidate them. This invalidates our NativeModules (perhaps not all but only `RCTNetworking`). 3. The `RCTBlobManager.addNetworkingHander` method call finally executes, with `RCTNetworking`'s methodQueue set to nil, which throws this error. Changelog: [iOS][Fixed] - Fix RCTBlobManager cleanup crash Reviewed By: PeteTheHeat Differential Revision: D20498096 fbshipit-source-id: d2d60984637ddf883278289258aa9b2ae81bb172
This commit is contained in:
committed by
Facebook GitHub Bot
parent
48fe460ed9
commit
91c5ff4a12
@@ -142,6 +142,12 @@ RCT_EXPORT_METHOD(addNetworkingHandler)
|
||||
{
|
||||
RCTNetworking *const networking = _bridge ? _bridge.networking : [_turboModuleLookupDelegate moduleForName:"RCTNetworking"];
|
||||
|
||||
// TODO(T63516227): Why can methodQueue be nil here?
|
||||
// We don't want to do anything when methodQueue is nil.
|
||||
if (!networking.methodQueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch_async(networking.methodQueue, ^{
|
||||
[networking addRequestHandler:self];
|
||||
[networking addResponseHandler:self];
|
||||
|
||||
Reference in New Issue
Block a user