-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FinalizationRegistry refcounting bug (#656)
Introduced in commit 61c8fe6 from last month that moved the callback into the job queue: 1. It leaked `fre->held_val` when no job was enqueued 2. It fumbled the reference count when enqueuing; JS_EnqueueJob already takes care of incrementing and decrementing it Reverts commit 0a70623 from earlier today because that didn't turn out to be a complete fix. Fixes: #648
- Loading branch information
1 parent
aedd829
commit 9c5c441
Showing
2 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*--- | ||
negative: | ||
phase: runtime | ||
type: Error | ||
---*/ | ||
let finrec = new FinalizationRegistry(v => {}) | ||
let object = {object:"object"} | ||
finrec.register(object, {held:"held"}, {token:"token"}) | ||
object = undefined | ||
// abrupt termination should not leak |held| | ||
// unfortunately only shows up in qjs, not run-test262, | ||
// but still good to have a regression test | ||
throw Error("ok") |