From 51e77c37b5165aea7e0ce1cb8d67e9ee549975e4 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 11 Jul 2009 11:43:06 +0200 Subject: [PATCH] Do not call Detach() from Server::~Server. --- src/net.h | 7 +++++-- src/object_wrap.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/net.h b/src/net.h index 1449eb6fb46..a3b9a24f61c 100644 --- a/src/net.h +++ b/src/net.h @@ -128,7 +128,10 @@ protected: server_.on_connection = Server::on_connection; server_.data = this; } - virtual ~Server () { Close(); } + + virtual ~Server () { + oi_server_close (&server_); + } int Listen (struct addrinfo *address) { int r = oi_server_listen (&server_, address); @@ -138,7 +141,7 @@ protected: return 0; } - void Close ( ) { + void Close ( ) { oi_server_close (&server_); Detach(); } diff --git a/src/object_wrap.h b/src/object_wrap.h index b96fc364a69..4fcc304acd1 100644 --- a/src/object_wrap.h +++ b/src/object_wrap.h @@ -55,6 +55,8 @@ class ObjectWrap { * the object after making this call as it might be gone! * (A "weak reference" is v8 terminology for an object that only has a * persistant handle.) + * + * DO NOT CALL THIS FROM DESTRUCTOR */ void Detach() { assert(!handle_.IsEmpty());