Skip to content

Commit

Permalink
tls_wrap: ensure that TLSCallbacks are gc-able
Browse files Browse the repository at this point in the history
Call `MakeWeak()` to destruct TLSCallbacks when the js-object dies.

fix nodejs#8416
  • Loading branch information
indutny committed Sep 23, 2014
1 parent 64d6de9 commit 4845377
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down
3 changes: 2 additions & 1 deletion src/tls_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 4845377

Please sign in to comment.