diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-08-18 01:05:48 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-08-20 01:14:10 +0300 |
commit | 119c4ccf0ef2addc84fd638004a631f55c7aefc9 (patch) | |
tree | 03e2889956067200c5d84285a16288707a415ab3 /src/node_worker.h | |
parent | bdf07f4317ce738bbe56c5b91aaebf35d15052a8 (diff) |
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.
Refs: https://github.com/nodejs/node/pull/28788
Fixes: https://github.com/nodejs/node/issues/28777
Fixes: https://github.com/nodejs/node/issues/28773
PR-URL: https://github.com/nodejs/node/pull/29190
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/node_worker.h')
-rw-r--r-- | src/node_worker.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_worker.h b/src/node_worker.h index db3c95d2aef..ffc4f19882c 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -41,6 +41,7 @@ class Worker : public AsyncWrap { SET_SELF_SIZE(Worker) bool is_stopped() const; + std::shared_ptr<ArrayBufferAllocator> array_buffer_allocator(); static void New(const v8::FunctionCallbackInfo<v8::Value>& args); static void CloneParentEnvVars( @@ -59,6 +60,7 @@ class Worker : public AsyncWrap { std::vector<std::string> argv_; MultiIsolatePlatform* platform_; + std::shared_ptr<ArrayBufferAllocator> array_buffer_allocator_; v8::Isolate* isolate_ = nullptr; bool start_profiler_idle_notifier_; uv_thread_t tid_; |