fix(importer): release template claims after load failures - #301
Open
Ram-Dawson wants to merge 1 commit into
Open
fix(importer): release template claims after load failures#301Ram-Dawson wants to merge 1 commit into
Ram-Dawson wants to merge 1 commit into
Conversation
- Release the provisional holder claim when template loading, realization, stage setup, or reload registration fails. - Cover throwing codecs and concurrent pending loads.
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.
Fixes #300
Problem
loadScene()increments the shared template holder count before awaiting and realizing a scene. Previously, cleanup covered only template-load failures. If a custom component codec, node realization, stage application, or reload registration threw after the template was available, the caller received noNodeto pair withreleaseScene(), while its holder claim remained cached.Change
Keep the early holder increment as a provisional claim so concurrent loads continue to protect a shared pending template. Extend the
try/catchto cover template loading, realization, optional stage application, and hot-reload registration. On failure, release exactly one claim through a private helper.releaseScene()uses the same helper, so normal release and failure cleanup share the same decrement-and-evict behavior.Validation
packages/flutter_scene:flutter test(1129 passed, 31 skipped).packages/flutter_scene:flutter test test/fscene/scene_registry_test.dart(13 passed).Expected: falseandActual: true; the fixed implementation passes and leaves zero cached templates.packages/flutter_scene:flutter analyzecompleted with no issues.Scope and limitation
This fixes template claim accounting; it does not add per-request cancellation to
loadScene().releaseScene(path)remains key-based rather than a cancellation API for one particular in-flight request.