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>
This commit is contained in:
Albert Astals Cid 2015-03-20 16:38:15 +01:00
parent 633b950bd4
commit 1458d1b31d

View File

@ -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