Skip to content

cherry-pick(4.5-stable): Guard against nil _performOperations block in REANodesManager (#10229) - #10405

Merged
tjzel merged 1 commit into
4.5-stablefrom
@tjzel/4.5-stable/cherry-pick-#10229
Aug 25, 2026
Merged

tjzel merged 1 commit into
4.5-stablefrom
@tjzel/4.5-stable/cherry-pick-#10229

Conversation

@tjzel

@tjzel tjzel commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Cherry-picking #10229

…er (#10229)

> [!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

- [x] 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`.

(cherry picked from commit 0f8cf6d)
Co-authored-by: Tomasz Żelawski <tzelawski@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 25, 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: CHILL

Plan: Pro Plus

Run ID: 360b72b4-c7e0-49c5-8f70-5f2d71d8c3ff

📥 Commits

Reviewing files that changed from the base of the PR and between 00917d0 and fe84bf1.

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

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

performOperations now captures _performOperations, returns when the callback is nil, and invokes the callback only when it exists.

Merge Risk: ⚪ Minimal · up to fe84b

This localized change guards against a nil operation block; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description states that the pull request cherry-picks PR #10229, which matches the changeset and objectives.
Title check ✅ Passed The title clearly identifies the cherry-pick target, branch, and nil guard for _performOperations, which is the main change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@tjzel
tjzel merged commit 9d75de4 into 4.5-stable Aug 25, 2026
17 checks passed
@tjzel
tjzel deleted the @tjzel/4.5-stable/cherry-pick-#10229 branch August 25, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants