Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb46185-alternative' into 'mer-5.6'
Ignore Connecting states received after session has closed

See merge request mer-core/qtbase!48
  • Loading branch information
llewelld committed Jul 1, 2019
2 parents eef2159 + fcd0c68 commit 64c6650
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/network/access/qnetworkaccessmanager.cpp
Expand Up @@ -1616,11 +1616,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::connect(networkSessionStrongRef.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected()), Qt::QueuedConnection);
//QueuedConnection is used to avoid deleting the networkSession inside its closed signal
QObject::connect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), &QNetworkSession::stateChanged,
q, [this](QNetworkSession::State s) {
qCDebug(lcNetworkAccess) << "QNAM: network session state changed:" << s;
_q_networkSessionStateChanged(s);
}, Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));

Expand Down Expand Up @@ -1652,6 +1649,13 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state)
{
Q_Q(QNetworkAccessManager);
qCDebug(lcNetworkAccess) << "QNAM: network session state changed:" << state;

if ((state == QNetworkSession::Connecting) && (!getNetworkSession())) {
qCWarning(lcNetworkAccess) << "QNAM: ignoring Connecting state received after the session closed";
return;
}

bool reallyOnline = false;
//Do not emit the networkSessionConnected signal here, except for roaming -> connected
//transition, otherwise it is emitted twice in a row when opening a connection.
Expand Down

0 comments on commit 64c6650

Please sign in to comment.