mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
f34a2899e4
Summary: ## Rationale With the bridge, the invalidate method of every TurboModule gets called on the TurboModule's method queue. This ensures that we can safely clean up resources accessed in the TurboModule's async methods. In bridgeless mode, we don't invalidate each module on its method queue. After this diff, we will clean up every TurboModule on its own method queue. ## Changes - Make RCTInstance dealloc itself on the JavaScript thread. - Terminate the JavaScript thread on the JavaScript thread. This ensures that no work executes on the JavaScript thread after we clean up RCTInstance. - Make [RCTTurboModuleManager invalidate] execute right before RCTInstance terminates the JavaScript thread. - **Fix:** Make [RCTTurboModuleManger invalidate] synchronously invalidate modules on their own method queues. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D27933587 fbshipit-source-id: 7630e7fc074df2f5a3293192431105c747b8588f