Skip to content

Commit

Permalink
[qtbase] Ignore irrelevant session state change events. Contributes t…
Browse files Browse the repository at this point in the history
…o JB#33794

The next stateChanged() may already be queued by the time we have received
closed() signal and cleared the session reference. Sometimes that was
resulting in QNetworkAccessManager getting stuck in NotAccessible state.
  • Loading branch information
monich committed Dec 30, 2015
1 parent d826d97 commit 24e3ec5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/network/access/qnetworkaccessmanager.cpp
Expand Up @@ -1566,6 +1566,13 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
{
Q_Q(QNetworkAccessManager);

if (!networkSessionStrongRef) {
// The next stateChanged() may already be queued by the time we have
// received closed() signal and cleared the session reference.
lastSessionState = QNetworkSession::Invalid;
return;
}

//Do not emit the networkSessionConnected signal here, except for roaming -> connected
//transition, otherwise it is emitted twice in a row when opening a connection.
if (state == QNetworkSession::Connected && lastSessionState == QNetworkSession::Roaming)
Expand Down

0 comments on commit 24e3ec5

Please sign in to comment.