Skip to content

fix(iOS): guard against nil _performOperations block in REANodesManager - #10229

Merged
tomekzaw merged 1 commit into
mainfrom
@tomekzaw/fix-perform-operations-nil-crash
Aug 12, 2026
Merged

tomekzaw merged 1 commit into
mainfrom
@tomekzaw/fix-perform-operations-nil-crash

Conversation

@tomekzaw

Copy link
Copy Markdown
Member

Note

This pull request was authored by AI on behalf of @tomekzaw.

Summary

Fixes #10135.

-[REANodesManager performOperations] can be invoked on the main queue before registerPerformOperations: has run on the JS queue, in which case calling the nil _performOperations block crashes with EXC_BAD_ACCESS at 0x10. This PR reads the block ivar into a local and returns early when it is nil. Skipping a flush is harmless — pending updates are picked up on the next drain.

This fix was tested and proved to be successful in a production app that we develop at Software Mansion.

Test plan

Trigger an early main-queue drain (e.g. maybeFlushUIUpdatesQueue racing module initialization, as described in #10135) before the JS queue registers the block — the app no longer crashes on launch and animations work as expected afterwards.

Changelog

  • I added an entry to the Unpublished section of each changed package's CHANGELOG.md, or this PR does not change react-native-reanimated or react-native-worklets.

@tomekzaw
tomekzaw force-pushed the @tomekzaw/fix-perform-operations-nil-crash branch from 3a3e0af to b73a38c Compare August 11, 2026 21:03
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c21a9208-2daf-465a-959b-e2a2528edbd7

📥 Commits

Reviewing files that changed from the base of the PR and between 248dee7 and b73a38c.

📒 Files selected for processing (2)
  • packages/react-native-reanimated/CHANGELOG.md
  • packages/react-native-reanimated/apple/reanimated/apple/REANodesManager.mm

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an iOS crash that could occur when operations were triggered before the required callback was registered.
    • Improved stability by safely handling uninitialized operations.

Walkthrough

performOperations now safely handles an unregistered _performOperations callback on iOS. The change prevents invocation of a nil callback and adds a corresponding changelog entry.

Changes

iOS callback safety

Layer / File(s) Summary
Guard performOperations callback
packages/react-native-reanimated/apple/reanimated/apple/REANodesManager.mm, packages/react-native-reanimated/CHANGELOG.md
performOperations captures the callback, returns when it is unset, and invokes it when available. The changelog records the EXC_BAD_ACCESS crash fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the iOS fix for the nil _performOperations block guard in REANodesManager.
Description check ✅ Passed The description explains the startup race, EXC_BAD_ACCESS crash, defensive fix, testing, and changelog update.
Linked Issues check ✅ Passed The changes address issue #10135 by preventing nil _performOperations invocation and preserving later update processing.
Out of Scope Changes check ✅ Passed The implementation and changelog entry are directly related to the iOS crash fix described in issue #10135.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch @tomekzaw/fix-perform-operations-nil-crash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tomekzaw
tomekzaw merged commit 0f8cf6d into main Aug 12, 2026
10 checks passed
@tomekzaw
tomekzaw deleted the @tomekzaw/fix-perform-operations-nil-crash branch August 12, 2026 16:19
tjzel added a commit that referenced this pull request Aug 25, 2026
…n REANodesManager (#10229) (#10405)

Co-authored-by: Tomasz Zawadzki <tomekzawadzki98@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants