Page 1 of 1

Access Violation in TeeChart v7.08

Posted: Fri Mar 30, 2007 11:50 am
by 9242554
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

Posted: Fri Mar 30, 2007 12:05 pm
by narcis
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.

Posted: Fri Mar 30, 2007 12:36 pm
by 9242554
I post my files at news://www.steema.net/steema.public.attachments newsgroup "Access Violation in TeeChart v7.08 (Test Project)"

Posted: Thu Apr 05, 2007 2:37 pm
by Pep
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;