TeeChart Bug
Posted: Mon Jun 07, 2004 6:38 am
TeeChart 7.0
Assume Series1 and Series2 programmatically created and added to the Chart component.
Then code:
Chart.RemoveAllSeries;
Series1.Free;
Series2.Free;
Above code can cause exception error.
Series1.ParentChart := nil;
Series2.ParentChart := nil;
Series1.Free;
Series2.Free;
Above code will work properly.
Tracing the source code I figure out that RemoveAllSeries method is not the same as setting nil to ParentChart property for all series in the Chart component (as written in documentation). With RemoveAllSeries method, FMarks.ParentChart member of Series is not set to nil. That cause exception error during freeing Series component.
Suggestions:
Chart.RemoveSeries(Series1)
Series1.ParentChart := nil;
has to be equivalent.
Assume Series1 and Series2 programmatically created and added to the Chart component.
Then code:
Chart.RemoveAllSeries;
Series1.Free;
Series2.Free;
Above code can cause exception error.
Series1.ParentChart := nil;
Series2.ParentChart := nil;
Series1.Free;
Series2.Free;
Above code will work properly.
Tracing the source code I figure out that RemoveAllSeries method is not the same as setting nil to ParentChart property for all series in the Chart component (as written in documentation). With RemoveAllSeries method, FMarks.ParentChart member of Series is not set to nil. That cause exception error during freeing Series component.
Suggestions:
Chart.RemoveSeries(Series1)
Series1.ParentChart := nil;
has to be equivalent.