[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] kmail leaking KPopupMenus
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2003-12-30 12:05:08
Message-ID: 200312301304.36637 () erwin ! ingo-kloecker ! de
[Download RAW message or body]

On Tuesday 30 December 2003 12:26, Rolf Magnus wrote:
> 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.

Widgets are created on the stack all over the place. If a widget is 
deleted then it will surely tell its parent about that. Any other 
behavior would be braindead and I doubt we would be using Qt if it 
behaved this way.

IOW, did you test that it would crash?

Regards,
Ingo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic