Commit 4adbb68b authored by Laurent Montel's avatar Laurent Montel 😁

QNetworkReply was not deleted

Summary: delete networkreply

Reviewers: apol, #discover_software_store

Reviewed By: apol, #discover_software_store

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D19799
parent c4e8f04a
......@@ -179,7 +179,7 @@ void OdrsReviewsBackend::fetchReviews(AbstractResource *app, int page)
void OdrsReviewsBackend::reviewsFetched()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> replyPtr(reply);
if (reply->error() != QNetworkReply::NoError) {
qCWarning(LIBDISCOVER_LOG) << "error fetching reviews:" << reply->errorString();
m_isFetching = false;
......@@ -191,7 +191,6 @@ void OdrsReviewsBackend::reviewsFetched()
AbstractResource *resource = qobject_cast<AbstractResource*>(reply->request().originatingObject());
Q_ASSERT(resource);
parseReviews(document, resource);
// Store reviews to cache so we don't need to download them all the time
if (document.array().isEmpty()) {
return;
......@@ -244,6 +243,7 @@ void OdrsReviewsBackend::usefulnessSubmitted()
} else {
qCWarning(LIBDISCOVER_LOG) << "Failed to submit usefulness: " << reply->errorString();
}
reply->deleteLater();
}
QString OdrsReviewsBackend::userName() const
......@@ -295,6 +295,7 @@ void OdrsReviewsBackend::reviewSubmitted(QNetworkReply *reply)
} else {
qCWarning(LIBDISCOVER_LOG) << "Failed to submit review: " << reply->errorString();
}
reply->deleteLater();
}
void OdrsReviewsBackend::parseRatings()
......
......@@ -140,8 +140,8 @@ public:
void start()
{
auto replyGet = get(QNetworkRequest(m_url));
connect(replyGet, &QNetworkReply::finished, this, [this, replyGet] {
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> replyPtr(replyGet);
const QUrl originalUrl = replyGet->request().url();
if (replyGet->error() != QNetworkReply::NoError) {
qWarning() << "couldn't download" << originalUrl << replyGet->errorString();
......@@ -152,6 +152,7 @@ public:
const QUrl fileUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QLatin1Char('/') + originalUrl.fileName());
auto replyPut = put(QNetworkRequest(fileUrl), replyGet->readAll());
connect(replyPut, &QNetworkReply::finished, this, [this, originalUrl, fileUrl, replyPut]() {
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> replyPtr(replyPut);
if (replyPut->error() != QNetworkReply::NoError) {
qWarning() << "couldn't save" << originalUrl << replyPut->errorString();
Q_EMIT jobFinished(false, nullptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment