Deleting 'QNetworkReply *' returned by QNe

2019-07-20 20:06发布

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

标签: qt qt4
2条回答
Root(大扎)
2楼-- · 2019-07-20 20:24

you can do it in slot if readyRead

   reply->abort();
    reply->deleteLater();
    reply->manager()->deleteLater();
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-07-20 20:31

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.

查看更多
登录 后发表回答