react-native-macos/React/Base/macOS
Nick Trescases e877ebfe08
Mac RCTDisplayLink fix plus bonus deprecated API cleanup (#854)
Defensive changes to Mac RCTDisplayLink

Real-world data suggests crashes with this stack:
  CVDisplayLink::start()
  -[RCTDisplayLink updateJSDisplayLinkState] (RCTDisplayLink.m:157)
  -[RCTDisplayLink registerModuleForFrameUpdates:withModuleData:]_block_invoke (RCTDisplayLink.m:67)
  -[RCTTiming timerDidFire] (RCTTiming.mm:324)
  -[_RCTTimingProxy timerDidFire] (RCTTiming.mm:93)

Some symbols are missing in this stack, presumably due to compiler optimizations.
-updateJSDisplayLinkState is calling CVDisplayLinkStart as a result of a
call to "_jsDisplayLink.paused = NO".
-registerModuleForFrameUpdates block is presumably getting called via pauseCallback,
likely via [RCTTiming startTimers], presumably owned by RCTCxxBridge.

The most likely immediate explanation for the crash is that we are calling
CVDisplayLinkStart with a zombie _displayLink pointer.
However there is a lot of indirection here as well as thread-hopping, and
unfortunately no clearly incorrect code that would explain such a zombie pointer.

Some defensive changes:
-explicitly remove the association to pauseCallback when underlying display link object is invalidated.
-remove a prior attempt at additional check in updateJSDisplayLinkState itself as it is not relevant.
-make sure we explicitly set _displayLink to NULL when we release it, such that there is one less failure point.
2021-10-15 14:03:17 -07:00
..
RCTDynamicColor.h Replace ISS tags with Github OSS tags (#775) 2021-05-17 20:01:26 -07:00
RCTDynamicColor.m Replace ISS tags with Github OSS tags (#775) 2021-05-17 20:01:26 -07:00
RCTPlatform.m Replace ISS tags with Github OSS tags (#775) 2021-05-17 20:01:26 -07:00
RCTPlatformDisplayLink.m Mac RCTDisplayLink fix plus bonus deprecated API cleanup (#854) 2021-10-15 14:03:17 -07:00
RCTUIKit.m Set default value for enableFocusRing in RCTUIView init 2021-09-22 12:35:24 -07:00