fix(engine): don't crash when the runtime is dropped without close()#14
Open
wytzepiet wants to merge 1 commit into
Open
fix(engine): don't crash when the runtime is dropped without close()#14wytzepiet wants to merge 1 commit into
wytzepiet wants to merge 1 commit into
Conversation
The fjs bridge function captured the Ctx it runs in. Since the function lives on the global object, the context referenced itself and could never be freed, so dropping the runtime without close() (e.g. via Dart's GC) aborted in JS_FreeRuntime: Assertion failed: (list_empty(&rt->gc_obj_list)), quickjs.c:2308 Take ctx as a call-time argument instead of capturing it. The bridge function no longer pins its context, so the runtime frees cleanly on both the close() and drop paths. No API change. Adds a test that drops an engine-with-bridge without close(); it aborted before this change and passes now. Fixes fluttercandies#8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
|
Review result: No blocking issues found in this PR. The runtime-drop cleanup path and regression coverage look consistent with the intended behavior, and |
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 #8.
The
fjsbridge function captured theCtxit runs in. Since the function lives on the global object, that made the context reference itself — so it could never be freed. Dropping the runtime withoutclose()(e.g. via Dart's GC) then aborted inJS_FreeRuntime:Fix: take
ctxas a call-time argument instead of capturing it. The bridge function no longer pins its own context, so the runtime frees cleanly — on both theclose()and drop paths. No API change.Adds a test that drops an engine-with-bridge without
close(); it aborted before this change and passes now.🤖 Generated with Claude Code