[Panel-devel] Problem with caching applet backgrounds

Aaron J. Seigo aseigo at kde.org
Sun Jul 29 07:02:03 CEST 2007


On Saturday 28 July 2007, Thomas Georgiou wrote:
> The patch is attached.

* there's no need to new() pixmaps. it leads to memory leaks, such as how 
you're leaking backgroundPixmap.

* if (foo) { delete foo; } is meaningless as "delete 0;" is perfectly legal 
and fine; just do "delete foo;"

* you don't need a separate QSize to keep track of the size; just check the 
size of the cached pixmap

* changing var names from meaningful things like "topOffset" to "topO" is not 
cool =)

* pls follow the style guide. for instance, it is:

if (foo) {
    bar;
}

not

if (foo)
    bar;

* initialize your variables when you declare them if they don't have sensible 
built in initializers (POD types usually don't).

* i'm guessing the reason it's not painting the background except when it 
regenerates is that, well, it is painting it but at some random coordinate. 
when you re-gen the background leftO and topO are set to leftOffset and 
topOffset. otherwise they are not initialized at all and so you'll be 
painting at whatever (x,y) point that leftO and topO start out with.

-- 
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/20070728/76bfb6a9/attachment-0001.pgp 


More information about the Panel-devel mailing list