Skip to content

Run RCTAccessibilityManager methods on the main queue - #58476

Closed
christophpurrer wants to merge 1 commit into
react:mainfrom
christophpurrer:export-D119565016
Closed

Run RCTAccessibilityManager methods on the main queue#58476
christophpurrer wants to merge 1 commit into
react:mainfrom
christophpurrer:export-D119565016

Conversation

@christophpurrer

Copy link
Copy Markdown
Contributor

Summary:
RCTAccessibilityManager mirrors UIKit accessibility state into ivars from nine
NSNotificationCenter handlers, which are delivered on the main thread. The module
declared no methodQueue, so its exported methods ran on the JS thread instead, and
none of its properties are atomic.

That leaves the content size multipliers open to a data race. The multipliers
getter lazily assigns _multipliers on read and is reached from the main thread via
the content size category notification, while setAccessibilityContentSizeMultipliers:
reaches setMultipliers: from the JS thread and releases the previous dictionary.
Concurrent access can over-release that dictionary and leave a dangling pointer
behind, which then faults on the next message to it.

Declare methodQueue as the main queue so the exported methods and the notification
handlers serialize on one thread. The module already requires main queue setup and
every method reads UIKit-derived state, so this matches how it is used.

Changelog:
[iOS][Fixed] - Fix data race on accessibility content size multipliers in RCTAccessibilityManager

Differential Revision: D119565016

Summary:
RCTAccessibilityManager mirrors UIKit accessibility state into ivars from nine
NSNotificationCenter handlers, which are delivered on the main thread. The module
declared no methodQueue, so its exported methods ran on the JS thread instead, and
none of its properties are atomic.

That leaves the content size multipliers open to a data race. The `multipliers`
getter lazily assigns `_multipliers` on read and is reached from the main thread via
the content size category notification, while `setAccessibilityContentSizeMultipliers:`
reaches `setMultipliers:` from the JS thread and releases the previous dictionary.
Concurrent access can over-release that dictionary and leave a dangling pointer
behind, which then faults on the next message to it.

Declare methodQueue as the main queue so the exported methods and the notification
handlers serialize on one thread. The module already requires main queue setup and
every method reads UIKit-derived state, so this matches how it is used.

Changelog:
[iOS][Fixed] - Fix data race on accessibility content size multipliers in `RCTAccessibilityManager`

Differential Revision: D119565016
@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 Sep 10, 2026
@meta-codesync

meta-codesync Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

@meta-codesync

meta-codesync Bot commented Sep 11, 2026

Copy link
Copy Markdown

This pull request has been merged in ea2ca1b.

@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Sep 11, 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.

1 participant