summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/qt/src/http_file_source.cpp6
-rw-r--r--platform/qt/src/http_file_source.hpp3
2 files changed, 5 insertions, 4 deletions
diff --git a/platform/qt/src/http_file_source.cpp b/platform/qt/src/http_file_source.cpp
index b8553a5a55..e4d89e3d64 100644
--- a/platform/qt/src/http_file_source.cpp
+++ b/platform/qt/src/http_file_source.cpp
@@ -20,7 +20,7 @@ void HTTPFileSource::Impl::request(HTTPRequest* req)
{
QUrl url = req->requestUrl();
- QPair<QNetworkReply*, QVector<HTTPRequest*>>& data = m_pending[url];
+ QPair<QPointer<QNetworkReply>, QVector<HTTPRequest*>>& data = m_pending[url];
QVector<HTTPRequest*>& requestsVector = data.second;
requestsVector.append(req);
@@ -45,7 +45,7 @@ void HTTPFileSource::Impl::cancel(HTTPRequest* req)
return;
}
- QPair<QNetworkReply*, QVector<HTTPRequest*>>& data = it.value();
+ QPair<QPointer<QNetworkReply>, QVector<HTTPRequest*>>& data = it.value();
QNetworkReply* reply = data.first;
QVector<HTTPRequest*>& requestsVector = data.second;
@@ -58,7 +58,7 @@ void HTTPFileSource::Impl::cancel(HTTPRequest* req)
if (requestsVector.empty()) {
m_pending.erase(it);
- reply->abort();
+ if (reply) reply->abort();
}
}
diff --git a/platform/qt/src/http_file_source.hpp b/platform/qt/src/http_file_source.hpp
index 4ba61b70da..e9c67a7fc8 100644
--- a/platform/qt/src/http_file_source.hpp
+++ b/platform/qt/src/http_file_source.hpp
@@ -7,6 +7,7 @@
#include <QNetworkAccessManager>
#include <QObject>
#include <QPair>
+#include <QPointer>
#include <QQueue>
#include <QUrl>
#include <QVector>
@@ -30,7 +31,7 @@ public slots:
void onReplyFinished();
private:
- QMap<QUrl, QPair<QNetworkReply *, QVector<HTTPRequest *>>> m_pending;
+ QMap<QUrl, QPair<QPointer<QNetworkReply>, QVector<HTTPRequest *>>> m_pending;
QNetworkAccessManager *m_manager;
};