[Lazarus] RFH: AV when deleting TAChart from the form
Martin
lazarus at mfriebe.de
Sun Apr 11 21:06:38 CEST 2010
On 11/04/2010 20:01, Martin wrote:
> On 11/04/2010 19:39, Martin wrote:
>> On 11/04/2010 18:37, Alexander Klenin wrote:
>>> On Mon, Apr 12, 2010 at 02:02, Martin<lazarus at mfriebe.de> wrote:
>>>> 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.
> I applied your other patch [ FreeAndNil(Fseries); // if FSeries = nil
> then exit ]
> And I no longer get the crash, so that works.
>
> --------------------
>
> As for calls to GetChildren
>
> the first happens when
> FreeAndNil(FSeries)
> is called.
>
> I looked through the Callstack, and it seems more than reasonable:
>
> FSerieas.Free, calls TChartSeriesList.Clear;
> This destorys some TCharts that are hold by FSeries
> [ Items[i].FChart := nil; ] => TCharts are components,
Sorry one line off, next line
Items[i].Free;
in
procedure TChartSeriesList.Clear;
var
i: Integer;
begin
for i := 0 to FList.Count - 1 do begin
Items[i].FChart := nil;
Items[i].Free;
end;
FList.Clear;
end;
Items are TLineSeries and they are TComponents
> so they notify there owner, and everyone who requested it, about their
> death. => The owner is the Form, and the form tells OI => and OI makes
> sure that all of its own structures are good (RefreshSelection;
> TComponentTreeView.RebuildComponentNodes; and the likes)
>
> IMHO that is reasonable.
>
> I wont do it, but if you dig deeper, you will find that the other
> calls are of similar nature.
>
> Bottomline is, that any Component must expect all kinds of calls
> during it's destruction, and must at least return them without crash.
>
> And hey, the best I have seen was a WM_SETFOCUS to a Component in
> destruction. I couldn't believe it.....
>
> Martin
>
>
>
>
>
>
>
>
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
More information about the Lazarus
mailing list