Skip to content

Initialize module-class registry in RCTGetModuleClasses (#60119) - #60119

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
christophpurrer:export-D132788274
Nov 20, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
christophpurrer:export-D132788274

Conversation

@christophpurrer

@christophpurrer christophpurrer commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

RCTModuleClasses and RCTModuleClassesSyncQueue were only created inside RCTRegisterModule. When RCT_REMOVE_LEGACY_COMPONENT_INTEROP is defined, RCTViewManager is no longer registered through RCTRegisterModule, so an app with no other legacy modules registered this way never creates the queue. RCTGetModuleClasses() then calls dispatch_sync(NULL, ...) during RCTHost start and crashes with SIGSEGV.

This moves the one-time initialization into RCTEnsureModuleClassesRegistry(), which both RCTGetModuleClasses and RCTRegisterModule call. With no registered modules, RCTGetModuleClasses now returns an empty array.

No visible UI change.

Changelog:

[iOS][Fixed] - Fix crash in RCTGetModuleClasses when no legacy modules have been registered (e.g. with RCT_REMOVE_LEGACY_COMPONENT_INTEROP)

Differential Revision: D132788274

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 18, 2026
@meta-codesync

meta-codesync Bot commented Nov 18, 2026

Copy link
Copy Markdown

@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D132788274.

@christophpurrer christophpurrer added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner meta-exported labels Nov 18, 2026
@meta-codesync meta-codesync Bot changed the title Initialize module-class registry in RCTGetModuleClasses Initialize module-class registry in RCTGetModuleClasses (#60119) Nov 18, 2026
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Nov 18, 2026
Summary:

`RCTModuleClasses` and `RCTModuleClassesSyncQueue` were only created inside `RCTRegisterModule`. When `RCT_REMOVE_LEGACY_COMPONENT_INTEROP` is defined, `RCTViewManager` is no longer registered through `RCTRegisterModule`, so an app with no other legacy modules registered this way never creates the queue. `RCTGetModuleClasses()` then calls `dispatch_sync(NULL, ...)` during `RCTHost` start and crashes with SIGSEGV.

This moves the one-time initialization into `RCTEnsureModuleClassesRegistry()`, which both `RCTGetModuleClasses` and `RCTRegisterModule` call. With no registered modules, `RCTGetModuleClasses` now returns an empty array.

No visible UI change.

## Changelog:
[iOS][Fixed] - Fix crash in `RCTGetModuleClasses` when no legacy modules have been registered (e.g. with `RCT_REMOVE_LEGACY_COMPONENT_INTEROP`)

Differential Revision: D132788274
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Visual regression

No visual differences at 4341618c573a.

android: no capture

Summary:

`RCTModuleClasses` and `RCTModuleClassesSyncQueue` were only created inside `RCTRegisterModule`. When `RCT_REMOVE_LEGACY_COMPONENT_INTEROP` is defined, `RCTViewManager` is no longer registered through `RCTRegisterModule`, so an app with no other legacy modules registered this way never creates the queue. `RCTGetModuleClasses()` then calls `dispatch_sync(NULL, ...)` during `RCTHost` start and crashes with SIGSEGV.

This moves the one-time initialization into `RCTEnsureModuleClassesRegistry()`, which both `RCTGetModuleClasses` and `RCTRegisterModule` call. With no registered modules, `RCTGetModuleClasses` now returns an empty array.

No visible UI change.

## Changelog:
[iOS][Fixed] - Fix crash in `RCTGetModuleClasses` when no legacy modules have been registered (e.g. with `RCT_REMOVE_LEGACY_COMPONENT_INTEROP`)

Differential Revision: D132788274
@vzaidman
vzaidman self-requested a review November 20, 2026 10:36
@meta-codesync
meta-codesync Bot merged commit ca5e7bc into react:main Nov 20, 2026
80 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @christophpurrer in ca5e7bc

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants