Skip to content

Commit 935f843

Browse files
committed
Allow ObjectWrap destructors before Wrap()
1 parent 9e8df0e commit 935f843

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/node_object_wrap.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ class ObjectWrap {
1313
}
1414

1515
virtual ~ObjectWrap ( ) {
16-
handle_->SetInternalField(0, v8::Undefined());
17-
handle_.Dispose();
18-
handle_.Clear();
16+
if (!handle_.IsEmpty()) {
17+
assert(handle_.IsNearDeath());
18+
handle_->SetInternalField(0, v8::Undefined());
19+
handle_.Dispose();
20+
handle_.Clear();
21+
}
1922
}
2023

2124
template <class T>

0 commit comments

Comments
 (0)