Skip to content

Commit dbf0d6b

Browse files
committed
ClearWeak on ObjectWraps. I /think/ this is the correct semantics
1 parent 8ff7954 commit dbf0d6b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/node_object_wrap.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ObjectWrap {
1616
virtual ~ObjectWrap ( ) {
1717
if (!handle_.IsEmpty()) {
1818
assert(handle_.IsNearDeath());
19+
handle_.ClearWeak();
1920
handle_->SetInternalField(0, v8::Undefined());
2021
handle_.Dispose();
2122
handle_.Clear();
@@ -82,7 +83,8 @@ class ObjectWrap {
8283
ObjectWrap *obj = static_cast<ObjectWrap*>(data);
8384
assert(value == obj->handle_);
8485
assert(!obj->refs_);
85-
if (value.IsNearDeath()) delete obj;
86+
assert(value.IsNearDeath());
87+
delete obj;
8688
}
8789
};
8890

0 commit comments

Comments
 (0)