On 11/04/2010 15:37, Alexander Klenin wrote:
On Mon, Apr 12, 2010 at 01:28, Martin<[email protected]> 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
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus