Access Violation in TeeChart v7.08

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Impet
Newbie
Newbie
Posts: 6
Joined: Thu Sep 21, 2006 12:00 am

Access Violation in TeeChart v7.08

Post by Impet » Fri Mar 30, 2007 11:50 am

I used TeeChart v7.08 Win32 for Delphi 2006.

Sometimes Access Violation appears.
I analysed the nature of this error and prepare small Test Project to reproduce it. But I don't found, how I can sand it.
--------

Problem consists in the following:
1. TeeChart Owner component is destroyed.
2. TeeChart.Series.DataSource is destroyed before TeeChart.
TeeChart.Series.DataSource is not set to nil on DataSource.RemoveNotify as csDestroying in ComponentState => TChartSeries.InternalRemoveDataSource does nothing.
3. Memory used for TeeChart.Series.DataSource is reallocated.
4. TeeChart destructor is called.
Further Error CallStack follows:

TCustomAxisPanel.Destroy
TCustomAxisPanel.FreeAllSeries
TChartSeries.SetParentChart
TCustomAxisPanel.RemoveSeries
TChartSeries.Removed
TChartSeries.RemoveAllLinkedSeries
TObject(DataSources[0]) is TChartSeries - Access Violation

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 30, 2007 12:05 pm

Hi Impet,

It would be very helpful if you could arrange a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Impet
Newbie
Newbie
Posts: 6
Joined: Thu Sep 21, 2006 12:00 am

Post by Impet » Fri Mar 30, 2007 12:36 pm

I post my files at news://www.steema.net/steema.public.attachments newsgroup "Access Violation in TeeChart v7.08 (Test Project)"

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Apr 05, 2007 2:37 pm

Hi Impet,

to solve it you can add a FreeAllSeries method into the destructor :

Code: Select all

destructor TForm2.Destroy;
var
  Temp: Pointer;
  Size: Integer;
begin
  //!!! Next code is for example only (is not real)
  //!!! It destroy ClientDataSet1 before DBChart1 and simulate Delphi memory
  //!!! manager work for reallocated ClientDataSet1 memory

  Temp := ClientDataSet1;
  Size := ClientDataSet1.InstanceSize;

  DBChart1.FreeAllSeries(nil);

  FreeAndNil(ClientDataSet1);

  FillChar(Temp^, Size, 0);

  inherited;
end;

Post Reply