[PATCH] kmail leaking KPopupMenus

Rolf Magnus ramagnus at kde.org
Tue Dec 30 11:26:28 GMT 2003

On Tuesday 30 December 2003 12:02, André Wöbbeking wrote:
> On Tuesday 30 December 2003 11:48, Rolf Magnus wrote:
> > Attached is a patch for a small leak in KMail. Whenever you drag/drop
> > a mail into a mail folder, a new KPopupMenu for selection between
> > copy and move is created, but not destroyed. This patch creates the
> > menu once and reuses it.
> why not creating the menu on the stack, i.e.
> KPopupMenu menu( this );
> menu.insertItem( i18n("&Move Here"), DRAG_MOVE, 0 );
> ...
> int id = menu.exec( QCursor::pos(), 0 );

The popup menu is created as child of the list view. When the list view itself 
is deleted, all the children get deleted too, but there is no menu to be 
deleted => boom. It might work by doing a removeChild() afterwards, but I'm 
not sure if that's sufficient.

More information about the kde-core-devel mailing list