From 0b21c15b11e9af64741e26822f33dfba5975d9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 18 Nov 2020 11:44:59 +0100 Subject: HTTP2: fix crash from assertion In general the protocolHandler isn't deleted unless the channel is being destructed. So instead of reset()ing the pointer we keep it around. Also update the http2protocolhandler to mimic the http1 handler a little closer: shutting down the channel in receiveReply if there's no reply/activeStreams, and not calling receiveReply at all if there's no activeStreams. Pick-to: 5.15 Change-Id: I702547f594deb6b0c1384068f7e93e560527e8e2 Reviewed-by: Timur Pocheptsov --- src/network/access/qhttp2protocolhandler.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/network/access/qhttp2protocolhandler.cpp') diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index de6b5ac18f..8f77911341 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -264,7 +264,8 @@ void QHttp2ProtocolHandler::_q_uploadDataDestroyed(QObject *uploadData) void QHttp2ProtocolHandler::_q_readyRead() { - _q_receiveReply(); + if (!goingAway || activeStreams.size()) + _q_receiveReply(); } void QHttp2ProtocolHandler::_q_receiveReply() @@ -272,6 +273,11 @@ void QHttp2ProtocolHandler::_q_receiveReply() Q_ASSERT(m_socket); Q_ASSERT(m_channel); + if (goingAway && activeStreams.isEmpty()) { + m_channel->close(); + return; + } + while (!goingAway || activeStreams.size()) { const auto result = frameReader.read(*m_socket); switch (result) { -- cgit v1.2.3