diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-18 04:24:20 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-02-18 04:31:30 (GMT) |
commit | e0eb03ec78330b5b2bd064267db71992d81d88c5 (patch) | |
tree | b94078dc13cacee60bf5e0037c3acf3eef46990b /src | |
parent | 49f63d8f37fcd45ebe527f3554ff7b4c34d8545e (diff) | |
download | Qt-e0eb03ec78330b5b2bd064267db71992d81d88c5.zip Qt-e0eb03ec78330b5b2bd064267db71992d81d88c5.tar.gz Qt-e0eb03ec78330b5b2bd064267db71992d81d88c5.tar.bz2 |
Allow QNAM to be created as a global variable.
QNetworkConfigurationManager cannot be loaded before QApplication as the
plugins it loads may create timers. Which fail because timers can only
be created in threads created with QThread.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 10 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager_p.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 69b57e5..ea60f98 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -386,9 +386,6 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) : QObject(*new QNetworkAccessManagerPrivate, parent) { ensureInitialized(); - - QNetworkConfigurationManager manager; - d_func()->createSession(manager.defaultConfiguration()); } /*! @@ -847,6 +844,13 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QDisabledNetworkReply(this, req, op); } + if (d->initializeSession && !d->networkSession) { + QNetworkConfigurationManager manager; + d->createSession(manager.defaultConfiguration()); + + d->initializeSession = false; + } + QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && outgoingData && !outgoingData->isSequential()) { diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 8a1f19d..8d772f0 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -77,6 +77,7 @@ public: #endif networkSession(0), networkAccessEnabled(true), + initializeSession(true), cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -121,6 +122,7 @@ public: QNetworkSession *networkSession; bool networkAccessEnabled; + bool initializeSession; bool cookieJarCreated; |