From 935f8437fd375270a0c12a106ad5b0f64da93e01 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 4 Jun 2010 14:23:45 -0700 Subject: Allow ObjectWrap destructors before Wrap() --- src/node_object_wrap.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/node_object_wrap.h') 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 -- cgit v1.2.3