Skip to content

Commit

Permalink
js_stream: fix leak of instances
Browse files Browse the repository at this point in the history
Don't forget to call `MakeWeak` to ensure that instance objects are
garbage collectable.

PR-URL: #1078
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
indutny committed Mar 6, 2015
1 parent 583a868 commit dccb69a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ JSStream::JSStream(Environment* env, Handle<Object> obj, AsyncWrap* parent)
: StreamBase(env),
AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent) {
node::Wrap(obj, this);
MakeWeak<JSStream>(this);
}


Expand Down
3 changes: 2 additions & 1 deletion src/js_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class JSStream : public StreamBase, public AsyncWrap {
v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context);

~JSStream();

void* Cast() override;
bool IsAlive() override;
bool IsClosing() override;
Expand All @@ -28,7 +30,6 @@ class JSStream : public StreamBase, public AsyncWrap {

protected:
JSStream(Environment* env, v8::Handle<v8::Object> obj, AsyncWrap* parent);
~JSStream();

AsyncWrap* GetAsyncWrap() override;

Expand Down

0 comments on commit dccb69a

Please sign in to comment.