1

We're migrating our XE projects to XE5, however, we encountered the access violation exception about teechart during the test.

I've created a test application to recreate the issue. With the test app, it works fine when open the first teechart form but will get the access violation exception when open it second time or open a new form.

Please refer to the attached test app from the following QC (embarcadero).

http://qc.embarcadero.com/wc/qcmain.aspx?d=122729

When debug it with DCUs. The exception happened when notifying TDBChart's OnStateChange event.

procedure TDataSet.DataEvent(Event: TDataEvent; Info: NativeInt);
begin
  ...
  if NotifyDataSources then
  begin
    for I := 0 to FDataSources.Count - 1 do
      FDataSources[I].DataEvent(Event, Info);  // <<---- Access  Violation
    if FDesigner <> nil then FDesigner.DataEvent(Event, Info);
  end;
end;
Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Delphi v19.0.14356.6604; TDBChart: "TeeChart Lite for RAD Studio, Delphi, C++Builder XE5 Update 2". http://cc.embarcadero.com/item/29708 – user3349133 Feb 25 '14 at 01:50
  • Welcome to StackOverflow. Please [edit] your post to include the *relevant code* from your test app here. Expecting people to go to EMBT to download it just to figure out what you're asking isn't quite how StackOverflow works. If the external link is unavailable for some reason, it makes your question meaningless, and that code also can't be located in a search by future readers looking for a solution to a similar problem. Thanks. – Ken White Feb 25 '14 at 02:08

1 Answers1

1

As David Berneda said at Quality Central:

Its related to using an internal TObjectList generic collection inside DBChart. The code has been improved so the error is fixed now (a new code takes care of destroying the ObjectList items correctly).

As a workaround, you can add this code at your form's OnClose event:

type
  TChartAccess=class(TDBChart);

procedure TOutcomesGraphFm.bbtnCloseClick(Sender: TObject);
begin
  TChartAccess(dbcBar).RemovedDataSource(bsTestScores,bsTestScores.DataSource);

  Close;
end;
Community
  • 1
  • 1
Narcís Calvet
  • 7,304
  • 5
  • 27
  • 47