[Lazarus] RFH: AV when deleting TAChart from the form

Alexander Klenin klenin at gmail.com
Sun Apr 11 19:37:59 CEST 2010


On Mon, Apr 12, 2010 at 02:02, Martin <lazarus at mfriebe.de> wrote:

> I think the patch is correct then. (When I found that FMarks was destroyed,
> I overlooked that the TChartSeries holding it, were also destroyed)
>
> destructor TChart.Destroy;
> begin
>  FSeries.Free;
> ...
>  inherited Destroy;
> end;
>
> inherited destroy calls getChildren, which accesses FSeries.

Even that I would call suspicious, but I think the problem is deeper.
The crash still happens even if I comment out the call to inherited Destroy
in TChart.Destroy.
Also, the callstacks I get after the crash do not contain TChart.Destroy
This suggests that ComponentTreeView/ObjectInstector code
does call TChart.GetChildern after TChart.Destroy, and the patch I posted
works only because the freed memory is not reused yet during
the call to GetChildren.
This is why I asked for help -- I suspect there is a bug in
ComponentTreeView/ObjectInstector code, but there are only a few people
capable of understanding it, and I am not one of them.

> Btw, I would change all foo.free into FreeAndNil(Foo)
> just in case there are more issues hiding

Yes, it is the item number 15 in my TAChart todo list ;-)

-- 
Alexander S. Klenin




More information about the Lazarus mailing list