Suresh
Suresh

Reputation: 9595

Deleting 'QNetworkReply *' returned by QNetworkAccessManager::post

QNetworkAccessManager::post function returns network reply object, is caller required to delete this or network access manager will take care of deleting it.?

Upvotes: 2

Views: 2444

Answers (2)

vlukham
vlukham

Reputation: 409

you can do it in slot if readyRead

   reply->abort();
    reply->deleteLater();
    reply->manager()->deleteLater();

Upvotes: 1

Lukáš Lalinský
Lukáš Lalinský

Reputation: 41306

From the documentation:

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.

Upvotes: 4

Related Questions