Ticket #46496: Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch

File Reset-QNAM-s-NetworkConfiguration-when-state-changes.patch, 1.8 KB (added by RJVB (René Bertin), 10 years ago)

from Ubuntu

  • qtbase/src/network/access/qnetworkaccessmanager.cpp

    From 0d9f3517935cf1fe194926a99208f3426d2104af Mon Sep 17 00:00:00 2001
    From: Lorn Potter <lorn.potter@gmail.com>
    Date: Mon, 27 Oct 2014 19:26:47 +1000
    Subject: [PATCH] Reset QNAM's NetworkConfiguration when state changes.
    
    Since QNAM is initialized with defaultConfiguration, we need to
    reset the internal configuration used to the current
    defaultConfiguration when the state changes and a new configuration
    becomes the default.
    
    Task-number: QTBUG-40234
    Change-Id: I50f23c62804f29370915eecac2c92301c5f3ead2
    ---
     src/network/access/qnetworkaccessmanager.cpp | 12 +++++++++++-
     1 file changed, 11 insertions(+), 1 deletion(-)
    
     
    11431143    if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) {
    11441144        QNetworkConfigurationManager manager;
    11451145        if (!d->networkConfiguration.identifier().isEmpty()) {
    1146             d->createSession(d->networkConfiguration);
     1146            if ((d->networkConfiguration.state() & QNetworkConfiguration::Defined)
     1147                    && d->networkConfiguration != manager.defaultConfiguration())
     1148                d->createSession(manager.defaultConfiguration());
     1149            else
     1150                d->createSession(d->networkConfiguration);
     1151
    11471152        } else {
    11481153            if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
    11491154                d->createSession(manager.defaultConfiguration());
     
    15981603    if (customNetworkConfiguration) {
    15991604        online = (networkConfiguration.state() & QNetworkConfiguration::Active);
    16001605    } else {
     1606        if (isOnline && online != isOnline) {
     1607            networkSessionStrongRef.clear();
     1608            networkSessionWeakRef.clear();
     1609        }
     1610
    16011611        online = isOnline;
    16021612    }
    16031613}