TAChart: Fix memory leak and images disappearing after save in TChartImageList

git-svn-id: trunk@33217 -
This commit is contained in:
ask 2011-11-02 11:47:39 +00:00
parent 194bd3d594
commit edb96895c4

View File

@ -160,8 +160,7 @@ begin
FSeriesCount += 1; FSeriesCount += 1;
end; end;
if Assigned(FOnPopulate) then FOnPopulate(Self); if Assigned(FOnPopulate) then FOnPopulate(Self);
except finally
ClearAllSeries;
FreeAndNil(legendItems); FreeAndNil(legendItems);
FreeAndNil(bmp); FreeAndNil(bmp);
end; end;
@ -192,14 +191,14 @@ procedure TChartImageList.WriteData(AStream: TStream);
var var
ch: TChart; ch: TChart;
begin begin
ch := FChart; ch := Chart;
try try
// Don't write the series images to stream. // Don't write the series images to stream.
// They will be recreated automatically when the chart is assigned on loading. // They will be recreated automatically when the chart is assigned on loading.
Chart := nil; Chart := nil;
inherited WriteData(AStream); inherited WriteData(AStream);
finally finally
FChart := ch; Chart := ch;
end; end;
end; end;