Commit ea2ca1b
Run RCTAccessibilityManager methods on the main queue (#58476)
Summary:
Pull Request resolved: #58476
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`
Reviewed By: javache
Differential Revision: D119565016
fbshipit-source-id: 53cee1f9f5984519964e0e8fa8df12f1e7fa88f71 parent be53e3a commit ea2ca1b
1 file changed
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
0 commit comments