Answer the question
In order to leave comments, you need to log in
How does garbage collection work in Qt?
How much can you rely on the Qt garbage collector? In particular, we are interested in the option when some class returns raw pointers. For example:
QNetworkReply * reply = networkAccessManager_->post(request, params.encodedQuery());
QNetworkAccessManager::~QNetworkAccessManager() Destroys the QNetworkAccessManager object and frees up any resources. Note that QNetworkReply objects that are returned from this class have this object set as their parents, which means that they will be deleted along with it if you don't call QObject::setParent() on them.
Answer the question
In order to leave comments, you need to log in
The assembly works according to a hierarchical model - the class that generated the objects destroys the children when it is deleted (by sending them a signal).
If you want to improve - delete it yourself, nothing terrible will happen.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question