@@ -548,8 +548,8 @@ Http2Session::~Http2Session() { |
548 | 548 | ClearWrap(object()); |
549 | 549 | persistent().Reset(); |
550 | 550 | CHECK(persistent().IsEmpty()); |
551 | | - for (const auto& iter : streams_) |
552 | | - iter.second->session_ = nullptr; |
| 551 | + for (const auto& stream : streams_) |
| 552 | + stream.second->session_ = nullptr; |
553 | 553 | Unconsume(); |
554 | 554 | DEBUG_HTTP2SESSION(this, "freeing nghttp2 session"); |
555 | 555 | nghttp2_session_del(session_); |
@@ -1782,11 +1782,11 @@ Http2Stream::Http2Stream( |
1782 | 1782 |
|
1783 | 1783 |
|
1784 | 1784 | Http2Stream::~Http2Stream() { |
1785 | | - if (session_ != nullptr) { |
1786 | | - DEBUG_HTTP2STREAM(this, "tearing down stream"); |
1787 | | - session_->RemoveStream(this); |
1788 | | - session_ = nullptr; |
1789 | | - } |
| 1785 | + if (session_ == nullptr) |
| 1786 | + return; |
| 1787 | + DEBUG_HTTP2STREAM(this, "tearing down stream"); |
| 1788 | + session_->RemoveStream(this); |
| 1789 | + session_ = nullptr; |
1790 | 1790 |
|
1791 | 1791 | persistent().Reset(); |
1792 | 1792 | CHECK(persistent().IsEmpty()); |
@@ -1862,7 +1862,8 @@ inline void Http2Stream::Destroy() { |
1862 | 1862 | // We can destroy the stream now if there are no writes for it |
1863 | 1863 | // already on the socket. Otherwise, we'll wait for the garbage collector |
1864 | 1864 | // to take care of cleaning up. |
1865 | | - if (!stream->session()->HasWritesOnSocketForStream(stream)) |
| 1865 | + if (stream->session() == nullptr || |
| 1866 | + !stream->session()->HasWritesOnSocketForStream(stream)) |
1866 | 1867 | delete stream; |
1867 | 1868 | }, this, this->object()); |
1868 | 1869 |
|
|