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