diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 20f5c81..d0bb054 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -56,10 +56,13 @@ QT_BEGIN_NAMESPACE static QBasicAtomicPointer<QNetworkConfigurationManagerPrivate> connManager_ptr; Q_GLOBAL_STATIC(QMutex, connManager_mutex) +static QBasicAtomicInt appShutdown; static void connManager_cleanup() { // this is not atomic or thread-safe! + int shutdown = appShutdown.fetchAndStoreAcquire(1); + Q_ASSERT(shutdown == 0); if(connManager_ptr) connManager_ptr->cleanup(); connManager_ptr = 0; @@ -73,7 +76,7 @@ void QNetworkConfigurationManagerPrivate::addPostRoutine() static QNetworkConfigurationManagerPrivate *connManager() { QNetworkConfigurationManagerPrivate *ptr = connManager_ptr.fetchAndAddAcquire(0); - if (!ptr) { + if (!ptr && !appShutdown) { QMutexLocker locker(connManager_mutex()); if (!(ptr = connManager_ptr.fetchAndAddAcquire(0))) { ptr = new QNetworkConfigurationManagerPrivate; |