diff options
author | Anna Henningsen <anna@addaleax.net> | 2021-07-19 12:52:58 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2021-07-22 14:38:20 +0300 |
commit | b6d4e2797a761794e292a664ee92823034c17c88 (patch) | |
tree | 2c75b2a5621650abe7caef0355239d63d09b21ec /src/base_object-inl.h | |
parent | 2765f2af79bd8bdfb2f8e5a6473ac1c278521fd4 (diff) |
src: close HandleWraps instead of deleting them in OnGCCollect()
When all strong `BaseObjectPtr`s to a `HandleWrap` are gone, we
should not delete the `HandleWrap` outright, but instead close
it and then delete it only once the libuv close callback has been
called.
Based on the valgrind output from the issue below, this has a
good chance of fixing it.
Fixes: https://github.com/nodejs/node/issues/39036
PR-URL: https://github.com/nodejs/node/pull/39441
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/base_object-inl.h')
-rw-r--r-- | src/base_object-inl.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/base_object-inl.h b/src/base_object-inl.h index ff3610c60a8..ad900b6399f 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -201,7 +201,7 @@ void BaseObject::decrease_refcount() { unsigned int new_refcount = --metadata->strong_ptr_count; if (new_refcount == 0) { if (metadata->is_detached) { - delete this; + OnGCCollect(); } else if (metadata->wants_weak_jsobj && !persistent_handle_.IsEmpty()) { MakeWeak(); } |