From 25c03a888f45c9666517c95334fb93c5f10930e3 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 19 Oct 2011 11:07:40 +0100 Subject: [PATCH] Use QBasicAtomicInt as a static variable QAtomicInt has a constructor, so QBasicAtomicInt needs to be used instead to allow compile time initialisation. Task-Number: QTBUG-20343 Reviewed-By: Olivier Goffart (cherry picked from commit 29495592d27505feff024d574e1333809794c304) Change-Id: Ia531c74f47daa86ba24a1b01bee36ddb1101af11 Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccessbackend.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 8d59be2..e8483a9 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -72,10 +72,10 @@ public: QMutex mutex; //this is used to avoid (re)constructing factory data from destructors of other global classes - static QAtomicInt valid; + static QBasicAtomicInt valid; }; Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData) -QAtomicInt QNetworkAccessBackendFactoryData::valid; +QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = Q_BASIC_ATOMIC_INITIALIZER(0); QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() { @@ -85,7 +85,7 @@ QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() { - if (QNetworkAccessBackendFactoryData::valid) { + if (QNetworkAccessBackendFactoryData::valid.load()) { QMutexLocker locker(&factoryData()->mutex); factoryData()->removeAll(this); } @@ -94,7 +94,7 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request) { - if (QNetworkAccessBackendFactoryData::valid) { + if (QNetworkAccessBackendFactoryData::valid.load()) { QMutexLocker locker(&factoryData()->mutex); QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(), end = factoryData()->constEnd(); -- 2.7.4