[Panel-devel] Problem with caching applet backgrounds
Aaron J. Seigo
aseigo at kde.org
Sun Jul 29 17:52:58 CEST 2007
On Sunday 29 July 2007, Thomas Georgiou wrote:
> On Sunday 29 July 2007 01:02:03 am Aaron J. Seigo wrote:
> > * there's no need to new() pixmaps. it leads to memory leaks, such as how
> > you're leaking backgroundPixmap.
>
> Wouldn't the pixmap be deleted after the function returns though?
no, you have to explicitly delete memory allocated by new.
> And should i store it as a pointer or by value in the d-pointer?
assuming you are referring to cachedContents[1], you may as well do it pointer
there and just make sure to delete it in the dtor as you did.
the backgroundPixmap variable doesn't need to be stored outside of
paintBackground in any case.
[1] which is a slightly confusing name given that elsewhere in the
code "contents" refers to what the applet subclass paints in paintInterface
and that we aren't actually caching those contents at all, but the background
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20070729/44602748/attachment.pgp
More information about the Panel-devel
mailing list