[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:       Bernd Gehrmann <bernd () physik ! hu-berlin ! de>
Date:       1999-08-30 15:33:37
[Download RAW message or body]

On Mon, 30 Aug 1999 Waldo Bastian wrote:

>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..... 

>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..... 

These are exactly the considerations which led to the design decision
that in C++ this is not possible! After the execution of the destructor,
all variables declared in the corresponding class are undefined. So
setting a variable at the end of the destructor is not good programming
practice, as it deludes the reader of the code into thinking that the
assignment has any effect.

Regarding virtual methods: If you have a class A and a class
B which is derived from A, then you cannot call any virtual methods
overridden by B in the constructor or destructor of A. BTW, this is the 
reason why the method KFileDialog::swallower() is completely useless.

Bernd

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

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