n-api: back up env before async work finalize
We must back up the value of _env
before calling the async work
complete callback, because the complete callback may delete the
instance in which _env
is stored by calling napi_delete_async_work
,
and because we need to use it after the complete callback has
completed.
Fixes: https://github.com/nodejs/node/issues/20966
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines