[PATCH] kmail leaking KPopupMenus

Ingo Klöcker kloecker at kde.org
Tue Dec 30 11:58:39 GMT 2003

On Tuesday 30 December 2003 11:53, Rolf Magnus 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.
> Hmpf, forgot the header... complete patch attached.

a) IMO the popup should only be created if it's really used so that no 
memory is wasted for people that have disabled the popup. So please 
initialize mDnDPopup with 0 and create it the first time it's used in 

b) You should delete mDnDPopup in the d'tor of KMFolderTree. Otherwise 
we still leak a popup. Note that the user can open several main windows 
(File->New Window) and that each main window would leak one popup.

c) If the popup is created on the stack (as André suggested) then it has 
to be created each time. Since the contents of the popup is static we 
can save the creation time by using Rolf's approach.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20031230/9d799f07/attachment.sig>

More information about the kde-core-devel mailing list