QNetworkReply was not deleted
ClosedPublic

Authored by mlaurent on Mar 16 2019, 8:26 AM.

Details

Summary

delete networkreply

Diff Detail

Repository
R134 Discover Software Store
Branch
delete_qnetwork_reply (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 9652
Build 9670: arc lint + arc unit
mlaurent created this revision.Mar 16 2019, 8:26 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 16 2019, 8:26 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mlaurent requested review of this revision.Mar 16 2019, 8:26 AM
apol added inline comments.Mar 16 2019, 9:29 AM
libdiscover/appstream/OdrsReviewsBackend.cpp
186

indentation

libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
149

Indentation

mlaurent updated this revision to Diff 53998.Mar 16 2019, 9:35 AM

Fix indent

broulik added inline comments.
libdiscover/appstream/OdrsReviewsBackend.cpp
186

Can't you call this at the beginng of the method? Or let it be owned by a QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> replyPtr(sender()); instead of calling deleteLater() explicitly before each return

mlaurent updated this revision to Diff 54015.Mar 16 2019, 2:25 PM

Use QScopedPointer<QNetworkReply, QScopedPointerDeleteLater>

apol added inline comments.Mar 16 2019, 4:20 PM
libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
143

This will crash here because it's passed into the connect, so it will be deleted when the function leaves and accessed from the lambda.

157

This will crash too.

apol added a comment.Mar 16 2019, 4:20 PM

How about connecting: connect(reply, &QNetworkReply::finished, reply, &QObject::deleteLater); after instantiating and be done with it?

broulik added inline comments.Mar 16 2019, 4:30 PM
libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
143

Just move the QScopedPointer into the lambda, which is what I was thinking about (wasn't clear in my comment, sorry)

mlaurent updated this revision to Diff 54387.Mar 20 2019, 7:00 AM

Fix QScopedPointer

is it ok now ?

apol accepted this revision.Mar 23 2019, 6:12 PM
This revision is now accepted and ready to land.Mar 23 2019, 6:12 PM
This revision was automatically updated to reflect the committed changes.