Mercurial > hg > svcore
changeset 834:fcee7e040ab4
Merge
author | Chris Cannam |
---|---|
date | Tue, 30 Jul 2013 18:15:30 +0100 |
parents | 3cc81dbc31bb (diff) a1bb2989013d (current diff) |
children | 1d439494604c |
files | data/fileio/FileSource.cpp |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp Wed Jul 24 18:24:55 2013 +0100 +++ b/data/fileio/FileSource.cpp Tue Jul 30 18:15:30 2013 +0100 @@ -25,6 +25,7 @@ #include <QFileInfo> #include <QDir> #include <QCoreApplication> +#include <QThreadStorage> #include <iostream> #include <cstdlib> @@ -67,7 +68,7 @@ } #endif -static QNetworkAccessManager nm; +static QThreadStorage<QNetworkAccessManager *> nms; FileSource::FileSource(QString fileOrUrl, ProgressReporter *reporter, QString preferredContentType) : @@ -264,6 +265,13 @@ void FileSource::init() { + { // check we have a QNetworkAccessManager + QMutexLocker locker(&m_mapMutex); + if (!nms.hasLocalData()) { + nms.setLocalData(new QNetworkAccessManager()); + } + } + if (isResource()) { #ifdef DEBUG_FILE_SOURCE std::cerr << "FileSource::init: Is a resource" << std::endl; @@ -452,7 +460,7 @@ QString("%1, */*").arg(m_preferredContentType).toLatin1()); } - m_reply = nm.get(req); + m_reply = nms.localData()->get(req); connect(m_reply, SIGNAL(readyRead()), this, SLOT(readyRead()));