mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Upstreaming a fix by ntre that fixes a crash we saw internally related to `[_queue cancelAllOperations]`. >Calling [_queue cancelAllOperations] will release all references to any active operations. >If the blocks of those operations have a reference to itself, it will result in dangling pointers, which could conceptually trigger a later crash if there's a race between the operation completing and it being pulled out of the queue. > >Add explicit strong reference while block is running. >For good measure, fix same pattern also in RCTFileRequestHandler. > >Note: separately, that this code is passing the op itself as a requestToken to [delegate URLRequest:] methods is suspect. That delegate can retain said token. ## Changelog: [IOS] [FIXED] - avoid race condition crash in [RCTDataRequestHandler invalidate] Pull Request resolved: https://github.com/facebook/react-native/pull/49705 Test Plan: Tested internally, we no longer saw the crash after this fix. Reviewed By: javache Differential Revision: D70314889 Pulled By: cipolleschi fbshipit-source-id: ebcecb4675bd1dda3d9ee60d69967feb4e05e11b