Clear RuntimeScheduler rendering updates on Scheduler destruction#169
Open
delekta wants to merge 3 commits into0.81.4-discordfrom
Open
Clear RuntimeScheduler rendering updates on Scheduler destruction#169delekta wants to merge 3 commits into0.81.4-discordfrom
delekta wants to merge 3 commits into0.81.4-discordfrom
Conversation
WoLewicki
approved these changes
Apr 24, 2026
WoLewicki
left a comment
There was a problem hiding this comment.
It looks good overall and I would consider adding it to RN core too. Still, I would want to investigate if maybe we've got some bug that makes the Scheduler dealloc before RuntimeScheduler does.
| // `clear()` blocks until any in-flight `updateRendering` finishes, so it | ||
| // is safe to destroy the delegate after this point. | ||
| if (runtimeScheduler) { | ||
| runtimeScheduler->clear(); |
There was a problem hiding this comment.
maybe move it higher up to where the first if (runtimeScheduler) { is ?
pmick
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
asana ticket
Fix use-after-free crash in Scheduler::uiManagerDidDispatchCommand / uiManagerDidFinishTransaction
When Scheduler is destroyed on the native thread, RuntimeScheduler_Modern's pending rendering-update queue can still hold lambdas that captured SchedulerDelegate* by value. Those lambdas fire later on the JS thread via updateRendering() and dereference the already-destroyed delegate — crashing with EXC_BAD_ACCESS (Sentry #7431302648).
Summary:
Changelog:
Test Plan: