Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
src: fix closing weak HandleWraps on GC
In 0af62aa, this was overlooked, with it
possibly leading to hard crashes.

Refs: #29317
  • Loading branch information
addaleax committed Sep 21, 2019
commit 20aae9d94adca943d9bea41eecddd370ae04f067
4 changes: 2 additions & 2 deletions src/handle_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ void HandleWrap::Close(Local<Value> close_callback) {
if (state_ != kInitialized)
return;

CHECK_EQ(false, persistent().IsEmpty());
uv_close(handle_, OnClose);
state_ = kClosing;

if (!close_callback.IsEmpty() && close_callback->IsFunction()) {
if (!close_callback.IsEmpty() && close_callback->IsFunction() &&
!persistent().IsEmpty()) {
object()->Set(env()->context(),
env()->handle_onclose_symbol(),
close_callback).Check();
Expand Down
3 changes: 3 additions & 0 deletions test/sequential/test-performance-eventloopdelay.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Flags: --expose-gc
'use strict';

const common = require('../common');
Expand Down Expand Up @@ -97,3 +98,5 @@ const {
}
spinAWhile();
}

process.on('exit', global.gc);
Comment thread
addaleax marked this conversation as resolved.