[lazarus] Order of destruction in TCustomListBox

Florian Klaempfl Florian.Klaempfl at gmx.de
Sat Dec 13 12:31:16 EST 2003


Stoian Ivanov wrote:
>  Hi all,
> 
> I'm monitoring this list from some time and this is the first time i notice
> a possible error condition:
> 
> 
>>>destructor TCustomListBox.Destroy;
>>>begin
>>>  FreeAndNil(FCanvas);
>>>  inherited Destroy;
>>>  FreeAndNil(FItems);
>>>end;
> 
> 
> On heavy load the sytem can map-out the page containing the object's data
> once it is freed via inherited Destroy thus invalidating the
> refference to FItems (assuming it is a field mamber) the solution to the
> problem (if destruction odret is to be kept) should be:

No, inherited destroy; doesn't release the memory of the current class. 
This is done after myobject.destroy; returns.







More information about the Lazarus mailing list