[Lazarus] RFH: AV when deleting TAChart from the form
Martin
lazarus at mfriebe.de
Sun Apr 11 17:02:28 CEST 2010
On 11/04/2010 15:37, Alexander Klenin wrote:
> On Mon, Apr 12, 2010 at 01:28, Martin<lazarus at mfriebe.de> wrote:
>
>>> must request a FreeNotification
>>> => so it can clear the variable/property if the component is destroyed
>>>
> So, are you saying that I should add a call to FreeNotification to the
> TBasicChartSeries destructor?
> BTW, another way to illustrate the issue is that attached patch fixes it,
> although obviously just by hiding the real problem.
>
Initialize I thought FMarks was a tcomponent => for a TComponent, i
would have done
FMarks.FreeNotification
and then added
TChartSeries.Notification(Acomponent...) override
to react to it.
But, it is only TPersistent.... => so that wasn't the cause.
=> hence forget about my comment about FreeNotification
-----------------
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.
Only question is, if anything still needs to see those children.
Maybe move inherited Destroy to the top, then you still can return the
children
I don't know which one is better. I don't know why the children are
queried, nor if anything important is done with them
--------
Btw, I would change all foo.free into FreeAndNil(Foo)
just in case there are more issues hiding
Martin
More information about the Lazarus
mailing list