Permalink
Browse files

Allow ObjectWrap destructors before Wrap()

  • Loading branch information...
1 parent 9e8df0e commit 935f8437fd375270a0c12a106ad5b0f64da93e01 @ry ry committed Jun 4, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/node_object_wrap.h
@@ -13,9 +13,12 @@ class ObjectWrap {
}
virtual ~ObjectWrap ( ) {
- handle_->SetInternalField(0, v8::Undefined());
- handle_.Dispose();
- handle_.Clear();
+ if (!handle_.IsEmpty()) {
+ assert(handle_.IsNearDeath());
+ handle_->SetInternalField(0, v8::Undefined());
+ handle_.Dispose();
+ handle_.Clear();
+ }
}
template <class T>

0 comments on commit 935f843

Please sign in to comment.