[Interest] Lifetime of QNetworkReply from QNetworkAccessManager
Jason H
jhihn at gmx.com
Tue Jan 30 04:47:47 CET 2018
> Sent: Monday, January 29, 2018 at 10:44 PM
> From: "Tom Isaacson" <Tom.Isaacson at navico.com>
> To: "Interest at qt-project.org" <Interest at qt-project.org>
> Subject: [Interest] Lifetime of QNetworkReply from QNetworkAccessManager
>
> If I call a function like QNetworkAccessManager::head() with a QNetworkRequest I get a pointer to a QNetworkReply. But who's responsible for clearing up the QNetworkReply? Is it me, is it parented to the QNetworkReply, is it parented to the QNetworkAccessManager? If the latter, if the QNetworkAccessManager lasts for the lifetime of my application are all the QNetworkReply's going to take memory for the lifetime of the app?
>
> I'd expect this to be covered in the documentation but I can't see anything:
> https://doc.qt.io/qt-5/qnetworkaccessmanager.html#head
>
It's in there:
"Note: After the request has finished, it is the responsibility of the user to delete the QNetworkReply object at an appropriate time. Do not directly delete it inside the slot connected to finished(). You can use the deleteLater() function."
More information about the Interest
mailing list