diff options
author | Rich Trott <rtrott@gmail.com> | 2022-03-16 09:16:00 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2022-03-18 16:32:22 +0300 |
commit | 44131ad638c6c5ad59e220297fd3bb802fb5b1f9 (patch) | |
tree | 26da597b1eef461df88814242b3dc4081bca6a64 /src/node_messaging.cc | |
parent | a66b9cabc84061f9189743a437893e5e58c8c0d1 (diff) |
worker: do not send message if port is closing
Fixes: https://github.com/nodejs/node/issues/42296
PR-URL: https://github.com/nodejs/node/pull/42357
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'src/node_messaging.cc')
-rw-r--r-- | src/node_messaging.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_messaging.cc b/src/node_messaging.cc index aac1245f269..6403950e9c8 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -980,7 +980,7 @@ void MessagePort::PostMessage(const FunctionCallbackInfo<Value>& args) { // Even if the backing MessagePort object has already been deleted, we still // want to serialize the message to ensure spec-compliant behavior w.r.t. // transfers. - if (port == nullptr) { + if (port == nullptr || port->IsHandleClosing()) { Message msg; USE(msg.Serialize(env, context, args[0], transfer_list, obj)); return; |