Skip to content

Commit

Permalink
src: remove HandleWrap instances from list once closed
Browse files Browse the repository at this point in the history
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: nodejs/quic#165
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>

PR-URL: #30374
Refs: nodejs/quic#141
Refs: nodejs/quic#149
Refs: nodejs/quic#141
Reviewed-By: David Carlier <devnexen@gmail.com>
  • Loading branch information
addaleax authored and MylesBorins committed Nov 21, 2019
1 parent 4222f24 commit 564c18e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/handle_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,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())
Expand Down

0 comments on commit 564c18e

Please sign in to comment.