diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-06-04 14:23:45 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-06-04 14:30:59 -0700 |
commit | 935f8437fd375270a0c12a106ad5b0f64da93e01 (patch) | |
tree | 1a119d1d3fc3487921ee9d0333df7889da71a5a4 | |
parent | 9e8df0e83644381da5d01e69317acbde9cbfbecd (diff) | |
download | node-new-935f8437fd375270a0c12a106ad5b0f64da93e01.tar.gz |
Allow ObjectWrap destructors before Wrap()
-rw-r--r-- | src/node_object_wrap.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index 534567b2e7..ccb1eb8c25 100644 --- a/src/node_object_wrap.h +++ b/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> |