diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2015-03-20 16:38:15 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals@canonical.com> | 2015-04-01 07:22:10 +0000 |
commit | 1458d1b31d2df20e79db9e873d36986bc87074a2 (patch) | |
tree | c73ed36810fab1216fcec2441d0fb2876f3a236c /src | |
parent | 633b950bd49a958cc2391692c9dd753431c80a4d (diff) |
Use allConfigurations instead of onlineConfigurations in isOnline()
We need it because otherwise code like
QNetworkConfigurationManager ncm;
qDebug() << "ONLINE" << ncm->isOnline();
may give the wrong value because the queued signals that have been just connected a few lines above
may not have been processed yet
Change-Id: I959db75ed17497ab91eeba2669ee2c8947244f00
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index ef7ab51462..6bbea1683c 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -276,7 +276,9 @@ bool QNetworkConfigurationManagerPrivate::isOnline() const { QMutexLocker locker(&mutex); - return !onlineConfigurations.isEmpty(); + // We need allConfigurations since onlineConfigurations is filled with queued connections + // and thus is not always (more importantly just after creation) up to date + return !allConfigurations(QNetworkConfiguration::Active).isEmpty(); } QNetworkConfigurationManager::Capabilities QNetworkConfigurationManagerPrivate::capabilities() const |