Page 1 of 1

access vialoation

Posted: Mon Jul 12, 2004 6:36 pm
by 9338144
Hi everybody,

I just upgraded from TeeChart version 4 to version 7. And now simple piece of code (that worked fine in version 4) produces access violation error (Access violation at address 00000000. Read of address 00000000)

Code:
====================
Chart1.RemoveAllSeries;
Chart1.AddSeries(Serie2);
====================
I just remove current series from the chart and add another one.

Error does not appear when this code is executing, error appears when you close application IF this code WAS executed.

I checked this forum and found several posts about similar (or may be the same problem).
E.g. http://www.teechart.net/support/modules ... 949cc714b6

But unfortunatelly I did not find solution.
Any ideas?

Regards
Alex

Posted: Mon Jul 12, 2004 7:41 pm
by 9338144
Looks like I found solution by myself (source codes much metter than any manual :-)

Before destroying Chart I added code to destroy all Series

Code: Select all

procedure TChartForm.FormDestroy(Sender: TObject);
begin
  //for TeeChart version 7!!!
  FreeAndNil(BarSeries);
  FreeAndNil(LineSeries);
  FreeAndNil(PntSeries);
  FreeAndNil(PntLineSeries);
end;
Now program works fine.
But it will be nice if you can make some modifications in TeeChart or document this feature

Regards
Alex

Posted: Tue Jul 13, 2004 6:14 am
by Marjan
Hi.

Also, instead of using the RemoveSeries, you can also use the FreeAllSeries or the code bellow:

Code: Select all

Series2.ParentChart := nil;
Series2.Free;

Posted: Wed Jul 14, 2004 1:10 am
by 9338144
No, I cannot. Application uses several preconfigured (at design time) series. So I should remove series from the chart but do not destroy them.

Regards
Alex