react-native-macos/React/CxxBridge
Kevin Gozali 8ad810717e iOS: when the bridge has been invalidated, NativeModule lookup should just return nil
Summary:
There's a corner case where:
* The bridge gets invalidated, and native modules are cleaning up themselves (but not done yet)
* Something asks for a NativeModule instance - ideally it should just get nil at this point
* If TM Manager is invalidating, we get nil correctly, but we continue thru the old NativeModule lookup logic
* The latter will fail anyway, and would throw a redbox (RCTLogError).

So, if the bridge is invalidated, if TM Manager returns nil, we should just return nil for old NativeModule lookup.

The module of interest is RCTImageLoader, which was requested by RCTImageView on deallocation. The problem is RCTImageView got dealloc'ed **after** the bridge has been invalidated, so the lookup would always fail...

Bonus: RCTImageView should just keep a weak ref to the RCTImageLoader, so that:
* if the imageLoader is still alive on image dealloc, it can still access them (last minute "meaningless" cleanup)
* if the imageLoader is gone, then the image deallocation doesn't do anything

Changelog: [iOS] [Fixed] - Fix module lookup race condition on bridge invalidation.

Reviewed By: p-sun, sammy-SC

Differential Revision: D21371845

fbshipit-source-id: 862dc07de18ddbfb90e87e24b8dbd001147ddce4
2020-05-03 09:32:54 -07:00
..
JSCExecutorFactory.h Clang format for all React Native files 2020-03-08 23:01:17 -07:00
JSCExecutorFactory.mm Implement nativePerformanceNow to improve Profiler API results (#27885) 2020-03-31 10:23:51 -07:00
NSDataBigString.h Clang format for all React Native files 2020-03-08 23:01:17 -07:00
NSDataBigString.mm Clang format for all React Native files 2020-03-08 23:01:17 -07:00
RCTCxxBridge.mm iOS: when the bridge has been invalidated, NativeModule lookup should just return nil 2020-05-03 09:32:54 -07:00
RCTCxxBridgeDelegate.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTMessageThread.h Clang format for all React Native files 2020-03-08 23:01:17 -07:00
RCTMessageThread.mm Clang format for all React Native files 2020-03-08 23:01:17 -07:00
RCTObjcExecutor.h Clang format for all React Native files 2020-03-08 23:01:17 -07:00
RCTObjcExecutor.mm Split loadApplicationScript into initializeRuntime and loadBundle (#27844) 2020-04-01 17:52:39 -07:00