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(-)
|
|
|
|
| 1143 | 1143 | if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) { |
| 1144 | 1144 | QNetworkConfigurationManager manager; |
| 1145 | 1145 | 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 | |
| 1147 | 1152 | } else { |
| 1148 | 1153 | if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) |
| 1149 | 1154 | d->createSession(manager.defaultConfiguration()); |
| … |
… |
|
| 1598 | 1603 | if (customNetworkConfiguration) { |
| 1599 | 1604 | online = (networkConfiguration.state() & QNetworkConfiguration::Active); |
| 1600 | 1605 | } else { |
| | 1606 | if (isOnline && online != isOnline) { |
| | 1607 | networkSessionStrongRef.clear(); |
| | 1608 | networkSessionWeakRef.clear(); |
| | 1609 | } |
| | 1610 | |
| 1601 | 1611 | online = isOnline; |
| 1602 | 1612 | } |
| 1603 | 1613 | } |