Skip to content

n-api: ensure scope present for finalization

Spent some time looking at https://github.com/nodejs/node-addon-api/pull/729 which was related to a crash during finalization when using node-addon-api ObjectWrap.

I think it should be fixed in core as opposed to node-addon-api as it should be possible to hit the same problem using N-API directly instead of node-addon-api.

It seems to be more subtle than the scope never being in place. The added is the simplest test that causes the problem to recreate when run under debug and without the change adding the scope.

Refs: https://github.com/nodejs/node-addon-api/issues/722

Ensure a scope is on stack during finalization as finalization functions can create JS Objects

Signed-off-by: Michael Dawson michael_dawson@ca.ibm.com

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading