XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dras
Newbie
Newbie
Posts: 5
Joined: Wed Oct 17, 2012 12:00 am

XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by dras » Fri Jun 28, 2013 8:59 pm

Hi,

After assigning nil to a datasource property of TPointSeries and then assigning existing DataSet FreeMM4 reports this error:
---------------------------
Project1.exe: Memory Error Detected
---------------------------
FastMM has detected an attempt to call a virtual method on a freed object. An access violation will now be raised in order to abort the current operation.

Freed object class: TDBChartDataSource

Virtual method: Destroy

....

---------------------------
OK
---------------------------
If I disable FastMM4 the app reports:
---------------------------
Project1
---------------------------
Invalid pointer operation.
---------------------------
OK
---------------------------
Part of the code is:

Code: Select all

procedure TForm1.Button2Click(Sender: TObject);
begin
  Series1.DataSource := nil;  // <-- this raises the error
  Series1.DataSource := ClientDataSet1;
end;
To reproduce it:
1.drop TDBChart
2.Create TPointSeries
3.Create TClientDataSet with 2 BCD fields for X and Y values.
4. Add several records
5. Assign the client dataset as datasource for the series
6.assign x and y
7.add button and use the code above.

For best results use FastMM4 in full debug mode.

Tools:
Delphi XE4 Update 1 and TeeChart Build 2013.08.130521


Please let me know for workaround or when it will be fixed?

dras
Newbie
Newbie
Posts: 5
Joined: Wed Oct 17, 2012 12:00 am

Re: XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by dras » Fri Jun 28, 2013 9:36 pm

P.S. This is working fine under XE3. (TeeChart Build 2013.08.130521)
Obviously the problem is under XE4.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by Yeray » Tue Jul 02, 2013 11:22 am

Hi,

You are right. I could reproduce the problem so I've added it to the wish list to be further investigated (TV52016629).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

dras
Newbie
Newbie
Posts: 5
Joined: Wed Oct 17, 2012 12:00 am

Re: XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by dras » Tue Jul 02, 2013 1:50 pm

Thanks!

Any Idea when will be the next release with the fix?

Also I'm seeing different look and feel under XE4 for the charts. They look blurry and some of the lines are dotted lines now. Is this planned behaviour or it is side effect from the new XE4?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by Yeray » Tue Jul 02, 2013 3:03 pm

Hi
dras wrote:Any Idea when will be the next release with the fix?
I'm afraid I can't tell you a date for this to be fixed. At this moment I'm not even sure if this is a TeeChart bug or an XE4 one.
In the meanwhile, you could just comment the conflictive line, isn't it?

Code: Select all

procedure TForm1.Button2Click(Sender: TObject);
begin
  //Series1.DataSource := nil;  // <-- this raises the error
  Series1.DataSource := ClientDataSet1;
end;
dras wrote:Also I'm seeing different look and feel under XE4 for the charts. They look blurry and some of the lines are dotted lines now. Is this planned behaviour or it is side effect from the new XE4?
This is because GDI+ is the default Canvas from TeeChart v2013.08. You can change to the old GDI:
- For the new charts: at the design time options (right click on the chart and select Options), go to the "New Chart" tab and change the "Render" option from GDi+ to GDI.
- For the current chart: at the design time editor (double click on the chart), go to the "3D\Render" tab and change from GDI+ to GDI.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

dras
Newbie
Newbie
Posts: 5
Joined: Wed Oct 17, 2012 12:00 am

Re: XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by dras » Thu Jul 18, 2013 4:14 pm

I have resolved these two issues.

1) Fixed problem with assigning nil to DataSource.
In DBChart.TCustomDBChart.RemovedDataSource Line 574 the following code was freeing the datasource at the list index:
{$IFNDEF AUTOREFCOUNT}
IDataSources[t].Free;
{$ENDIF}
this is not necessary in XE4 since the conditional compilation of TListOfDataSources makes it a descendant of TObjectList and the default is that TObjectList owns any objects so the following line IDataSources.Delete(t); destroys the object.

To resolve this error I commented out:
{$IFNDEF AUTOREFCOUNT}
IDataSources[t].Free;
{$ENDIF}

2) Fixed Canvas memory leak.

In TeeProcs.TCustomTeePanel.CreateDefaultCanvas() a conditional is used to determine when to create an internal canvas. When a chart is streamed in, the internal canvas is created. If the chart descends from another chart, this canvas was being leaked because it was being replaced with a newly created one.

I added the following code after line 1817:
if assigned(InternalCanvas) then
InternalCanvas.Free;

I have uploaded the two affected units.
Attachments
TeeChartBugFixes.rar
(42.8 KiB) Downloaded 504 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: XE4 + TeeChart Build 2013.08.130521 Series.DataSource bug

Post by Yeray » Fri Jul 19, 2013 10:25 am

Hi,
dras wrote: 1) Fixed problem with assigning nil to DataSource.
Thanks for the investigation and the suggestion. Note it was already identified and fixed:
http://qc.embarcadero.com/wc/qcmain.aspx?d=115925
Sorry for not noticing it before.

If you want to check the fix we implemented in the sources for next releases, at TCustomDBChart.Create, in DBChart, change this:

Code: Select all

IDataSources:=TListOfDataSources.Create;
For this:

Code: Select all

IDataSources:=TListOfDataSources.Create{$IFDEF D18}(False){$ENDIF};
dras wrote:2) Fixed Canvas memory leak.
We already fixed this, but thanks for reporting it and suggesting the fix too.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply