access vialoation

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
KS
Newbie
Newbie
Posts: 6
Joined: Mon Jul 12, 2004 4:00 am

access vialoation

Post by KS » Mon Jul 12, 2004 6:36 pm

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

KS
Newbie
Newbie
Posts: 6
Joined: Mon Jul 12, 2004 4:00 am

Post by KS » Mon Jul 12, 2004 7:41 pm

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

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Jul 13, 2004 6:14 am

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;
Marjan Slatinek,
http://www.steema.com

KS
Newbie
Newbie
Posts: 6
Joined: Mon Jul 12, 2004 4:00 am

Post by KS » Wed Jul 14, 2004 1:10 am

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

Post Reply