Add null safety to RootComponentView() to prevent crash during island…#8
Add null safety to RootComponentView() to prevent crash during island…#8gmacmaster wants to merge 1 commit intomainfrom
Conversation
… teardown RootComponentView() dereferenced a weak_ref without null checking. Changed return type from reference to pointer and added null guards at all 18 call sites to prevent crashes when pointer/keyboard events arrive after the ReactNativeIsland is destroyed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR adds null safety to Confidence Score: 5/5Safe to merge — the fix is minimal, targeted, and all call sites are consistently guarded. Every use of RootComponentView() is now null-checked before dereference. The change is mechanical and consistent across all 17 sites, with no new logic or regressions introduced. No custom rules are violated. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant EH as CompositionEventHandler
participant RCV as RootComponentView()
participant Island as ReactNativeIsland (weak ref)
participant RCVObj as RootComponentView object
EH->>RCV: call RootComponentView()
RCV->>Island: m_wkRootView.get() (promote weak ref)
alt island is null (already released)
RCV-->>EH: return nullptr
EH-->>EH: early return / break (no crash)
else island alive
Island->>RCVObj: GetComponentView()
RCVObj-->>RCV: raw pointer
RCV-->>EH: return pointer
EH->>RCVObj: dereference (GetFocusedComponent / hitTest / etc.)
end
Reviews (1): Last reviewed commit: "Add null safety to RootComponentView() t..." | Re-trigger Greptile |
No description provided.