summaryrefslogtreecommitdiff
path: root/src/node_object_wrap.h
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-06-04 14:23:45 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-06-04 14:30:59 -0700
commit935f8437fd375270a0c12a106ad5b0f64da93e01 (patch)
tree1a119d1d3fc3487921ee9d0333df7889da71a5a4 /src/node_object_wrap.h
parent9e8df0e83644381da5d01e69317acbde9cbfbecd (diff)
downloadandroid-node-v8-935f8437fd375270a0c12a106ad5b0f64da93e01.tar.gz
android-node-v8-935f8437fd375270a0c12a106ad5b0f64da93e01.tar.bz2
android-node-v8-935f8437fd375270a0c12a106ad5b0f64da93e01.zip
Allow ObjectWrap destructors before Wrap()
Diffstat (limited to 'src/node_object_wrap.h')
-rw-r--r--src/node_object_wrap.h9
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>