You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: avoid race condition crash in [RCTDataRequestHandler invalidate] (#49705)
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: #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
0 commit comments