worker: fix crash when SharedArrayBuffer outlives creating thread
Keep a reference to the ArrayBuffer::Allocator
alive for at least
as long as a SharedArrayBuffer
allocated by it lives.
The tests are taken 1:1 from https://github.com/nodejs/node/pull/28788.
Refs: https://github.com/nodejs/node/pull/28788 Fixes: https://github.com/nodejs/node/issues/28777 Fixes: https://github.com/nodejs/node/issues/28773
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines