From 4845377a139aadc4897de51cb1922f703af33ef8 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Tue, 23 Sep 2014 13:49:42 +0400 Subject: [PATCH] tls_wrap: ensure that TLSCallbacks are gc-able Call `MakeWeak()` to destruct TLSCallbacks when the js-object dies. fix #8416 --- src/tls_wrap.cc | 1 + src/tls_wrap.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 8e70b88d31e7..c65492cf3159 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -79,6 +79,7 @@ TLSCallbacks::TLSCallbacks(Environment* env, cycle_depth_(0), eof_(false) { node::Wrap(object(), this); + MakeWeak(this); // Initialize queue for clearIn writes QUEUE_INIT(&write_item_queue_); diff --git a/src/tls_wrap.h b/src/tls_wrap.h index 13a53bfb3075..34ae3ccbf653 100644 --- a/src/tls_wrap.h +++ b/src/tls_wrap.h @@ -46,6 +46,8 @@ class TLSCallbacks : public crypto::SSLWrap, public StreamWrapCallbacks, public AsyncWrap { public: + ~TLSCallbacks(); + static void Initialize(v8::Handle target, v8::Handle unused, v8::Handle context); @@ -94,7 +96,6 @@ class TLSCallbacks : public crypto::SSLWrap, Kind kind, v8::Handle sc, StreamWrapCallbacks* old); - ~TLSCallbacks(); static void SSLInfoCallback(const SSL* ssl_, int where, int ret); void InitSSL();