Files
Gabriel SchulhofandChengzhong Wu 171bb66ccc node-api: force env shutdown deferring behavior
The finalizer normally never gets called while a reference is strong.
However, during environment shutdown all finalizers must get called. In
order to unify the deferring behavior with that of a regular
finalization, we must force the reference to be weak when we call its
finalizer during environment shutdown.

Fixes: https://github.com/nodejs/node/issues/37236
Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/37303
Backport-PR-URL: https://github.com/nodejs/node/pull/42512
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-03-30 10:47:52 -04:00

12 lines
300 B
JavaScript

'use strict';
// This test makes no assertions. It tests a fix without which it will crash
// with a double free.
const { buildType } = require('../../common');
const addon = require(`./build/${buildType}/test_reference_double_free`);
{ new addon.MyObject(true); }
{ new addon.MyObject(false); }