Repository navigation
[web] Defer disposal of stale cached paths to FrameArena - #192072
Merged
auto-submit[bot] merged 6 commits intoSep 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request defers the disposal of invalidated backend paths in EnginePath by collecting them in a list and disposing them during the collect phase, preventing premature deallocation during concurrent rasterization. A new test is added to verify concurrent path mutation and rasterization. The review feedback suggests optimizing memory overhead by lazily initializing the stale paths list only when a path is invalidated, and updating the collection logic accordingly.
When mutating an EnginePath after building and drawing it in the same frame, _invalidateCachedPath() was prematurely disposing _cachedPath. In multi-threaded WebAssembly (skwasm), this eager mid-frame deallocation interleaved with background raster thread deallocations, leading to heap corruption and RuntimeError: memory access out of bounds in $emscripten_builtin_free. This change keeps invalidated BackendPath instances alive in _stalePaths until the end of the frame, respecting the FrameArena lifecycle contract. Fixes flutter#191976
mdebbar
force-pushed
the
fix_flutter_issue_191976
branch
from
August 31, 2026 18:43
fd63ba9 to
6183cb0
Compare
harryterkelsen
requested changes
Sep 9, 2026
This was referenced Sep 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.
When mutating an
EnginePathafter building and drawing it in the same frame,_invalidateCachedPath()was prematurely disposing_cachedPath.In multi-threaded WebAssembly (
skwasm), this eager mid-frame deallocation violated the lifecycle contract ofFrameArenaand caused native allocations to be freed on the main thread while background raster thread operations were deallocating previous display lists in the same linear memory space, leading to heap corruption andRuntimeError: memory access out of boundsin$emscripten_builtin_free.This change keeps invalidated
BackendPathinstances in_stalePathsuntil the end of the frame whenFrameArena.collect()runs.Fixes #191976
Pre-launch Checklist
///).