mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 01:41:35 +02:00
TAChart: Fix AV after TChart.ClearSeries call (issue #15173)
git-svn-id: trunk@22757 -
This commit is contained in:
parent
aa050e518f
commit
86af12370d
@ -99,10 +99,11 @@ type
|
|||||||
FList: TFPList;
|
FList: TFPList;
|
||||||
function GetItem(AIndex: Integer): TBasicChartSeries;
|
function GetItem(AIndex: Integer): TBasicChartSeries;
|
||||||
public
|
public
|
||||||
function Count: Integer;
|
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
public
|
||||||
|
procedure Clear;
|
||||||
|
function Count: Integer;
|
||||||
public
|
public
|
||||||
property Items[AIndex: Integer]: TBasicChartSeries read GetItem; default;
|
property Items[AIndex: Integer]: TBasicChartSeries read GetItem; default;
|
||||||
end;
|
end;
|
||||||
@ -531,7 +532,7 @@ end;
|
|||||||
|
|
||||||
procedure TChart.ClearSeries;
|
procedure TChart.ClearSeries;
|
||||||
begin
|
begin
|
||||||
FSeries.FList.Clear;
|
FSeries.Clear;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -691,6 +692,7 @@ begin
|
|||||||
i := FSeries.FList.IndexOf(ASeries);
|
i := FSeries.FList.IndexOf(ASeries);
|
||||||
if i < 0 then exit;
|
if i < 0 then exit;
|
||||||
FSeries.FList.Delete(i);
|
FSeries.FList.Delete(i);
|
||||||
|
ASeries.FChart := nil;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1159,6 +1161,17 @@ end;
|
|||||||
|
|
||||||
{ TChartSeriesList }
|
{ TChartSeriesList }
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
function TChartSeriesList.Count: Integer;
|
function TChartSeriesList.Count: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FList.Count;
|
Result := FList.Count;
|
||||||
@ -1170,13 +1183,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TChartSeriesList.Destroy;
|
destructor TChartSeriesList.Destroy;
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
for i := 0 to FList.Count - 1 do begin
|
Clear;
|
||||||
Items[i].FChart := nil;
|
|
||||||
Items[i].Free;
|
|
||||||
end;
|
|
||||||
FList.Free;
|
FList.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user