[lazarus] Order of destruction in TCustomListBox

Marc Weustink marc at dommelstein.net
Sat Dec 13 17:37:19 EST 2003


At 22:22 13-12-2003, Micha Nelissen wrote:
>Mattias Gaertner wrote:
>
>>On Sat, 13 Dec 2003 19:39:39 +0100  Micha Nelissen <micha at neli.hopto.org>
>>wrote:
>>
>>>Mattias Gaertner wrote:
>>>
>>>
>>>>On Sat, 13 Dec 2003 17:27:00 +0100  Micha Nelissen
>>>><micha at neli.hopto.org> wrote:
>>>>
>>>>
>>>>
>>>>>Mattias Gaertner wrote:
>>>>>
>>>>>
>>>>>>I think, we should keep fItems like the VCL until after the "inherited
>>>>>>Destroy;".
>>>>>
>>>>>Do you know why the order is like it is in the VCL?
>>>>
>>>>
>>>>Only Borland knows for sure.
>>>>Probably because calling the inherited Destroy produces notifications,
>>>>which can call code, that accesses the listbox items and would otherwise
>>>>need some ifs.
>>>
>>>Aah, the 'yucky'-ness of Object Pascal :-(.
>>
>>What do you mean?
>
>I don't like the fact of pascal that it's possible that overriden 
>functions get called although their constructor hasn't run or their 
>destructor has run.

That has nothing to do with object pascal, but all with the one who 
designed the classes you're using. IMO calling virtuals in yuor 
constructor/destructor isn't a bad thing if you know what you're doing. If 
things has to be called in a certain order, that is nothing different than 
programming other routines.

Just my opiion on this,

Marc








More information about the Lazarus mailing list