forked from Flowee/registry
Avoid setting the reply as member.
This commit is contained in:
+6
-4
@@ -18,9 +18,9 @@ void DownloadJob::start()
|
||||
{
|
||||
assert(m_sourceUrl.isValid());
|
||||
QNetworkRequest request(m_sourceUrl);
|
||||
m_reply = m_net->get(request);
|
||||
connect (m_reply, &QNetworkReply::finished, this, [=]() {
|
||||
if (m_reply->error() != QNetworkReply::NoError) {
|
||||
auto reply = m_net->get(request);
|
||||
connect (reply, &QNetworkReply::finished, this, [=]() {
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
// TODO mark file as not available somehow.
|
||||
logCritical() << "Download failed" << m_sourceUrl.toString();
|
||||
}
|
||||
@@ -32,9 +32,11 @@ void DownloadJob::start()
|
||||
if (!out.open(QIODevice::WriteOnly)) {
|
||||
logCritical() << "Opening file for writing failed" << m_targetFilePath;
|
||||
}
|
||||
out.write(m_reply->readAll());
|
||||
out.write(reply->readAll());
|
||||
out.flush();
|
||||
}
|
||||
reply->deleteLater();
|
||||
deleteLater();
|
||||
emit this->finished();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ private:
|
||||
QString m_targetFilePath;
|
||||
QUrl m_sourceUrl;
|
||||
|
||||
QNetworkReply *m_reply = nullptr;
|
||||
QNetworkAccessManager *m_net;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user