[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KDE 1.1.2 khtmlw memory leak patch - please test!
From: Waldo Bastian <bastian () suse ! de>
Date: 1999-08-30 9:10:52
[Download RAW message or body]
On Sat, 28 Aug 1999, Bo Thorsen wrote:
> On Sat, 28 Aug 1999, Bjarni R.
> Einarsson wrote:
>
> > Hi!
> >
> > Regarding http://bugs.kde.org/db/18/1812.html .
> >
> > I know I said I didn't know squat about Qt programming. Well I
> > don't. But the lack of responses here on kfm-devel, some browsing
> > of the khtmlw source code and "man qdict" inspired me to try
> > anyway.
> >
> > Attached is an untested patch to fix the X/pixmap/cache memory
> > leak in kdelibs/khtmlw. Yeah, I said untested. I don't have
> > enough horsepower on my desk to build the KDE libs here at home,
> > but I will test it when I get to work on Monday. Just compiling
> > the khtmlw widget to check for syntax errors was painful enough!
>
> One small change in the destructor:
>
> HTMLCachedImage::~HTMLCachedImage( )
> {
> if (pixmap) delete pixmap;
> pixmap = 0;
> }
>
> should be
>
> HTMLCachedImage::~HTMLCachedImage( )
> {
> delete pixmap;
> }
>
> delete tests for the pointer being 0, and it does not make sense to assign
> a variable in an object 2 milliseconds away from being deleted :-)
It's good programming practice to _always_ reset a pointer to 0 after
delting it. Perhaps another destructor gets called (itn the parent
object) which calls a virtual function which checks the pixmap
pointer.....
Better be safe than sorry.
Cheers,
Waldo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic