diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-07-09 12:49:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 11:49:20 +0200 |
commit | 3da182b0b86d93000d4473188f361ffa2de9fb73 (patch) | |
tree | df401be6bbf20e051c25ef18c364278546d737bf /ext/ffi/00_ffi.js | |
parent | 20cbd7f0f8f0e0ff4d6656f2fa7e93e01b8805f0 (diff) |
fix(ext/ffi): Avoid keeping JsRuntimeState RefCell borrowed for event loop middleware calls (#15116)
Diffstat (limited to 'ext/ffi/00_ffi.js')
-rw-r--r-- | ext/ffi/00_ffi.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index 2730cae72..22e442e51 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.js @@ -232,7 +232,9 @@ } unref() { - if (--this.#refcount === 0) { + // Only decrement refcount if it is positive, and only + // unref the callback if refcount reaches zero. + if (this.#refcount > 0 && --this.#refcount === 0) { core.opSync("op_ffi_unsafe_callback_ref", false); } } |