entering and leaving a new event loop will not perform the deferred deletion ?
In QT document of deleteLater ,it said:
Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.
I am not quite understand what it means, there is an article [url]http://agateau.wordpress.com/2010/09/29/fun-with-event-loops-and-qobjectdeletelater/[/url]
,but it is still confusing me .
could somebody give me an example for this ?
Re: entering and leaving a new event loop will not perform the deferred deletion ?
The discussion in the above link is helpful in understanding the use of deleteLater.
deleteLater has to be used exactly when you would want to delete the object that is allocated using new on the heap.
Make sure you do not refer to it again after you make this call.
It might deallocate the memory immediately or later based on which event has control on it.