Skip to content

Fix race causing NPE in AccessibilityInfoModule event emission#55792

Closed
alanleedev wants to merge 1 commit intofacebook:mainfrom
alanleedev:export-D94558522
Closed

Fix race causing NPE in AccessibilityInfoModule event emission#55792
alanleedev wants to merge 1 commit intofacebook:mainfrom
alanleedev:export-D94558522

Conversation

@alanleedev
Copy link
Copy Markdown
Contributor

Summary:
Fixing this reported crash:

android:java.lang.NullPointerException:com.facebook.react.modules.accessibilityinfo.AccessibilityInfoModule.updateAndSendTouchExplorationChangeEvent:unknown

Prevent NullPointerException crashes by removing a TOCTOU (Time-Of-Check to Time-Of-Use) race when emitting accessibility state change events.
The React context can become invalid between check and use; using a safe call on getReactApplicationContextIfActiveOrWarn ensures events are only sent when the context is active.

Changelog: [Internal]


Differential Revision: D94558522

Summary:
Fixing this reported crash:
```
android:java.lang.NullPointerException:com.facebook.react.modules.accessibilityinfo.AccessibilityInfoModule.updateAndSendTouchExplorationChangeEvent:unknown
```

Prevent `NullPointerException` crashes by removing a TOCTOU (Time-Of-Check to Time-Of-Use) race when emitting accessibility state change events.
The React context can become invalid between check and use; using a safe call on `getReactApplicationContextIfActiveOrWarn` ensures events are only sent when the context is active.

Changelog: [Internal]

---

Differential Revision: D94558522
@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 Feb 26, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Feb 26, 2026

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

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Feb 27, 2026

This pull request has been merged in 2f9711d.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @alanleedev in 2f9711d

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

zoontek pushed a commit to zoontek/react-native that referenced this pull request Mar 9, 2026
…ook#55792)

Summary:
Pull Request resolved: facebook#55792

Fixing this reported crash:
```
android:java.lang.NullPointerException:com.facebook.react.modules.accessibilityinfo.AccessibilityInfoModule.updateAndSendTouchExplorationChangeEvent:unknown
```

Prevent `NullPointerException` crashes by removing a TOCTOU (Time-Of-Check to Time-Of-Use) race when emitting accessibility state change events.
The React context can become invalid between check and use; using a safe call on `getReactApplicationContextIfActiveOrWarn` ensures events are only sent when the context is active.

Changelog: [Internal]

 ---

Reviewed By: mdvacca

Differential Revision: D94558522

fbshipit-source-id: 46edbf745b482e7d212ae5f0ed7a9fa3db7c7ba2
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. fb-exported 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.

3 participants