deleteLater on a member
-
This is probably a stupid question:
I have a class with a member progress dialog.
Whenever I activate a download process the class will spawn that dialog.
I don't want the dialog to linger between downloads, so I close it when the download was finished and also use deleteLater();Now to my question:
Will the old dialog be properly deleted if I do this at the beginning of the next download:
m_pdlg = new my_progress_dialog(...); -
Hi,
When calling deleteLater, the object should get deleted the next time the event loop runs.
-
Basically,
deleteLater
marks the object for deletion. So next time the Qt event loop runs, it will process that deletion request. This allows for anything pending on that object to be properly cleaned and then the object deleted. -
-
Yes it is, raw pointers don't reset themselves to zero.
If you want that kind of behaviour, use a QPointer or depending on your use-case a QScopedPointer.