mirror of
https://github.com/radareorg/quickjs.git
synced 2026-11-07 06:25:57 -10:00
Introduced in commit61c8fe6from 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 commit0a70623from earlier today because that didn't turn out to be a complete fix. Fixes: https://github.com/quickjs-ng/quickjs/issues/648
14 lines
369 B
JavaScript
14 lines
369 B
JavaScript
/*---
|
|
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")
|