Page 1 of 1

TeeChart Bug

Posted: Mon Jun 07, 2004 6:38 am
by 9336893
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.

Posted: Mon Jun 07, 2004 3:24 pm
by Marjan
Hi.

Instead of

Code: Select all

Series1.ParentChart := nil; 
Series2.ParentChart := nil; 
Series1.Free; 
Series2.Free; 
you could also call the

Code: Select all

Chart1.FreeAllSeries();
which does the same thing, but with single line call. Also, do not use the RemoveSeries or RemoveAllSeries if you're freeing series. The Remove* simply removes series from SeriesList and notifies it's parent about it.

TeeChart Bug

Posted: Mon Jun 07, 2004 3:45 pm
by 9336893
I can not use Chart1.FreeAllSeries.

Series1 and Series2 are global variables in my program and there can be more than one dialog with charts displaying those series (but one dialog at a time).

So I have to destroy those series during program termination.