Skip to content

Commit

Permalink
src: don't touch js object in Http2Session dtor
Browse files Browse the repository at this point in the history
Don't try to update the internal field pointer of the JS object in the
destructor.

The garbage collector invokes the destructor when the object is
collected and is not necessarily in a valid state anymore.

PR-URL: nodejs#18656
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
bnoordhuis authored and addaleax committed Mar 6, 2018
1 parent 3de8e57 commit 8c363cd
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,6 @@ Http2Session::Http2Session(Environment* env,

Http2Session::~Http2Session() {
CHECK_EQ(flags_ & SESSION_STATE_HAS_SCOPE, 0);
if (!object().IsEmpty())
ClearWrap(object());
DEBUG_HTTP2SESSION(this, "freeing nghttp2 session");
nghttp2_session_del(session_);
}
Expand Down

0 comments on commit 8c363cd

Please sign in to comment.