Abdelrazak Younes wrote:
Georg Baum a écrit :
Unless QFileDialog does some magic in addToolButton() we have a memory leak here. Can some Qt expert please tell whether this patch is OK?

I am not sure of that but I think I have read somewhere that it is safe to use pointers on Qt objects this way. If that is not the case then I guess there is a _lot_ of memory leaks everywhere in qt3 and qt4. But your code seems safe in any case. You could maybe use a smart pointer instead (boost::scoped_ptr or Qt::QPointer).

i don't think this is necessary, from the docs:

"When you create a QObject with another object as parent, it's added to the parent's children() list, and is deleted when the parent is."

Reply via email to