src: remove HandleWrap instances from list once closed

This allows keeping `BaseObjectPtr`s to `HandleWrap` instances.
Previously, the pointer kept the `HandleWrap` object alive, leaving
the Environment cleanup code that waits for the handle list to drain
in a busy loop, because only the `HandleWrap` destructor removed
the item from the list.

Refs: https://github.com/nodejs/quic/pull/165
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>

Backport-PR-URL: https://github.com/nodejs/node/pull/32301
PR-URL: https://github.com/nodejs/node/pull/30374
Refs: https://github.com/nodejs/quic/pull/141
Refs: https://github.com/nodejs/quic/pull/149
Refs: https://github.com/nodejs/quic/pull/141
Reviewed-By: David Carlier <devnexen@gmail.com>
This commit is contained in:
Anna Henningsen authored and Myles Borins committed 2020-04-01 17:36:42 -04:00
1 parent e17d314a21
commit 5f95e69f4d
1 file changed
+1
+1
View File
@@ -127,6 +127,7 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
wrap->state_ = kClosed;
wrap->OnClose();
wrap->handle_wrap_queue_.Remove();
if (!wrap->persistent().IsEmpty() &&
wrap->object()->Has(env->context(), env->handle_onclose_symbol())