tls_wrap: ensure that TLSCallbacks are gc-able

Call `MakeWeak()` to destruct TLSCallbacks when the js-object dies.

fix #8416

Reviewed-By: Fedor Indutny <fedor@indutny.com>
pull/23396/head
Fedor Indutny 2014-09-23 13:49:42 +04:00
parent 7c3c51b8ff
commit 4dbb84fc52
2 changed files with 3 additions and 1 deletions

View File

@ -79,6 +79,7 @@ TLSCallbacks::TLSCallbacks(Environment* env,
cycle_depth_(0),
eof_(false) {
node::Wrap<TLSCallbacks>(object(), this);
MakeWeak(this);
// Initialize queue for clearIn writes
QUEUE_INIT(&write_item_queue_);

View File

@ -46,6 +46,8 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
public StreamWrapCallbacks,
public AsyncWrap {
public:
~TLSCallbacks();
static void Initialize(v8::Handle<v8::Object> target,
v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context);
@ -94,7 +96,6 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
Kind kind,
v8::Handle<v8::Object> sc,
StreamWrapCallbacks* old);
~TLSCallbacks();
static void SSLInfoCallback(const SSL* ssl_, int where, int ret);
void InitSSL();