Memory leek using GDI instead of GDI+

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Whookie
Newbie
Newbie
Posts: 28
Joined: Fri Sep 24, 2004 4:00 am

Memory leek using GDI instead of GDI+

Post by Whookie » Wed Oct 30, 2013 11:55 am

How to trigger the error:
1. Make a new VCL application
2. Drop a TChart component on the main form
3. Edit the TChart: Edit Chart->Chart->3D->render and select GDI instead of GDI+
4. Run the application and close it

using any debug-memory manager of your choice will show you the leek...

As far as I could trace the error it happens in:

Code: Select all

procedure TCustomTeePanel.CreateDefaultCanvas;
var t   : Integer;
    tmp,
    tmpClass : TCanvas3DClass;
begin
  tmpClass:=TTeeCanvas3D;

  if IDefaultCanvas<>'' then
     for t:=0 to TeeRenderClasses.Count-1 do
     begin
       tmp:={$IFNDEF D18}TCanvas3DClass{$ENDIF}(TeeRenderClasses[t]);

       if tmp.ClassName=IDefaultCanvas then
       begin
         tmpClass:=tmp;
         break;
       end;
     end;

  if (not Assigned(InternalCanvas)) or (tmpClass<>InternalCanvas.ClassType) then
  begin
    InternalCanvas:=tmpClass.Create;
    InternalCanvas.ReferenceCanvas:=FDelphiCanvas;
  end;
end;

Maybe the only thing to do, is to Free the InternalCanvas:

Code: Select all

  if (not Assigned(InternalCanvas)) or (tmpClass<>InternalCanvas.ClassType) then
  begin
    if Assigned(InternalCanvas) then
       InternalCanvas.Free;
    InternalCanvas:=tmpClass.Create;
    InternalCanvas.ReferenceCanvas:=FDelphiCanvas;
  end;

but I could'nt try it, because the recompile tool seems to override all changes?!


/Edit: Using Delphi XE4 - TeeChart Pro v2013.08.130521 32bit VCL

David Berneda
Site Admin
Site Admin
Posts: 83
Joined: Wed Nov 12, 2003 5:00 am
Location: Girona, Catalonia
Contact:

Re: Memory leek using GDI instead of GDI+

Post by David Berneda » Wed Oct 30, 2013 2:30 pm

This problem is already fixed (InternalCanvas.Free), and will be included in next update.

btw: If you apply the changes at "...\TeeChart Sources\VCL" folder, changes are lost because TeeRecompile tool recreates this folder.
The "original" source unit that can be modified are one level up, at "..\TeeChart Sources" folder.

Post Reply