[lazarus] Order of destruction in TCustomListBox
Stoian Ivanov
sdr at bultra.com
Sat Dec 13 10:55:09 EST 2003
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:
destructor TCustomListBox.Destroy;
var
stack_FItems:Txxxxxxx
begin
stack_FItems:=FItems;
FreeAndNil(FCanvas);
inherited Destroy;
// FItems:=nill;
stack_FItems.Free;
end;
More information about the Lazarus
mailing list