diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-10-19 01:50:26 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-10-19 01:50:26 (GMT) |
commit | 3a9028d7ea6f14cf6039e6aba7606c4d71371338 (patch) | |
tree | 3a67e4ea2b6e6efd360d1f9163e8d65f439dc732 /src/network | |
parent | b2c4506dc8bd933b359d5ed2584cbcc7cd8a1258 (diff) | |
download | Qt-3a9028d7ea6f14cf6039e6aba7606c4d71371338.zip Qt-3a9028d7ea6f14cf6039e6aba7606c4d71371338.tar.gz Qt-3a9028d7ea6f14cf6039e6aba7606c4d71371338.tar.bz2 |
Fix crash on exit.
If QNetworkConfigurationManager is deleted from the QApplication
destructor it will be deleted after QNetworkConfigurationManagerPrivate
global static (which is also deleted by QApplication). Fixed by testing
if connManager() returns 0 before use.
Task-number: QTBUG-14447
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 23d7800..4c149a2 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -229,8 +229,8 @@ QNetworkConfigurationManager::QNetworkConfigurationManager( QObject* parent ) QNetworkConfigurationManager::~QNetworkConfigurationManager() { QNetworkConfigurationManagerPrivate *priv = connManager(); - - priv->disablePolling(); + if (priv) + priv->disablePolling(); } @@ -245,7 +245,11 @@ QNetworkConfigurationManager::~QNetworkConfigurationManager() */ QNetworkConfiguration QNetworkConfigurationManager::defaultConfiguration() const { - return connManager()->defaultConfiguration(); + QNetworkConfigurationManagerPrivate *priv = connManager(); + if (priv) + return priv->defaultConfiguration(); + + return QNetworkConfiguration(); } /*! @@ -275,7 +279,11 @@ QNetworkConfiguration QNetworkConfigurationManager::defaultConfiguration() const */ QList<QNetworkConfiguration> QNetworkConfigurationManager::allConfigurations(QNetworkConfiguration::StateFlags filter) const { - return connManager()->allConfigurations(filter); + QNetworkConfigurationManagerPrivate *priv = connManager(); + if (priv) + return priv->allConfigurations(filter); + + return QList<QNetworkConfiguration>(); } /*! @@ -286,7 +294,11 @@ QList<QNetworkConfiguration> QNetworkConfigurationManager::allConfigurations(QNe */ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier(const QString &identifier) const { - return connManager()->configurationFromIdentifier(identifier); + QNetworkConfigurationManagerPrivate *priv = connManager(); + if (priv) + return priv->configurationFromIdentifier(identifier); + + return QNetworkConfiguration(); } /*! @@ -301,7 +313,11 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( */ bool QNetworkConfigurationManager::isOnline() const { - return connManager()->isOnline(); + QNetworkConfigurationManagerPrivate *priv = connManager(); + if (priv) + return priv->isOnline(); + + return false; } /*! @@ -309,7 +325,11 @@ bool QNetworkConfigurationManager::isOnline() const */ QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabilities() const { - return connManager()->capabilities(); + QNetworkConfigurationManagerPrivate *priv = connManager(); + if (priv) + return priv->capabilities(); + + return QNetworkConfigurationManager::Capabilities(0); } /*! @@ -328,7 +348,9 @@ QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabil */ void QNetworkConfigurationManager::updateConfigurations() { - connManager()->performAsyncConfigurationUpdate(); + QNetworkConfigurationManagerPrivate *priv = connManager(); + if (priv) + priv->performAsyncConfigurationUpdate(); } #include "moc_qnetworkconfigmanager.cpp" |