Say we have:
pManager = new QNetworkAccessManager();
QObject::connect(pManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(finishedSlot(QNetworkReply*)));
and
void finished(QNetworkReply* reply);
If we delete reply inside finished
we will get segfault. Does this mean we shall not free it?
From http://doc.qt.io/qt-5/qnetworkreply.html:
Note: Do not delete the object in the slot connected to this signal. Use deleteLater().
From the QNetworkAccessManager
docs for the finished
signal:
Note: Do not delete the reply object in the slot connected to this signal. Use deleteLater().
So indeed, you should not delete it, but call deleteLater
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With