TAChart: Add try-finally block to TCubicSplineSeries.PrepareCoeffs. Issue #35268, patch by Marcin Wiazowski

git-svn-id: trunk@60821 -
This commit is contained in:
wp 2019-04-02 20:24:36 +00:00
parent c4c50a69c7
commit a92054a040

View File

@ -1541,22 +1541,31 @@ procedure TCubicSplineSeries.PrepareCoeffs;
var var
i: Integer = 0; i: Integer = 0;
j: Integer = 0; j: Integer = 0;
sCount: Integer = 0;
s: TSpline; s: TSpline;
begin begin
FreeSplines; FreeSplines;
SetLength(FX, Source.Count); SetLength(FX, Source.Count);
SetLength(FY, Source.Count); SetLength(FY, Source.Count);
SetLength(FSplines, Source.Count);
try
while i < Source.Count do begin while i < Source.Count do begin
s := TSpline.Create(self); s := TSpline.Create(self);
try
if s.PrepareCoeffs(Source, i, j) then begin if s.PrepareCoeffs(Source, i, j) then begin
SetLength(FSplines, Length(FSplines) + 1); FSplines[sCount] := s;
FSplines[High(FSplines)] := s; s := nil;
end sCount += 1;
else end;
finally
s.Free; s.Free;
end; end;
end;
SetLength(FX, j); SetLength(FX, j);
SetLength(FY, j); SetLength(FY, j);
finally
SetLength(FSplines, sCount);
end;
end; end;
procedure TCubicSplineSeries.SetBadDataPen(AValue: TBadDataChartPen); procedure TCubicSplineSeries.SetBadDataPen(AValue: TBadDataChartPen);