Memory leak patch for TCustomTeePanel.CreateDefaultCanvas
Posted: Wed Jun 19, 2013 11:49 am
Hi,
there is small but not welcomed memory leak in TeeProcs.TCustomTeePanel.CreateDefaultCanvas. When InternalCanvas is already set but has different ClassType, it is not freed but only replaced by another one. Such a way (in my case) one TTeeCanvas3D and one TTeeGradient is not freed for each instantiated Chart. I put InternalCanvas.Free before creation and assigning of the new Canvas, here is the patch:
Index: VCLTee.TeeProcs.pas
===================================================================
--- VCLTee.TeeProcs.pas (revision 315)
+++ VCLTee.TeeProcs.pas (working copy)
@@ -1813,6 +1813,7 @@
if (not Assigned(InternalCanvas)) or (tmpClass<>InternalCanvas.ClassType) then
begin
+ InternalCanvas.Free;
InternalCanvas:=tmpClass.Create;
InternalCanvas.ReferenceCanvas:=FDelphiCanvas;
end;
I'm using 2013 Pro +src version of VCLTee
Good luck
Vasek
there is small but not welcomed memory leak in TeeProcs.TCustomTeePanel.CreateDefaultCanvas. When InternalCanvas is already set but has different ClassType, it is not freed but only replaced by another one. Such a way (in my case) one TTeeCanvas3D and one TTeeGradient is not freed for each instantiated Chart. I put InternalCanvas.Free before creation and assigning of the new Canvas, here is the patch:
Index: VCLTee.TeeProcs.pas
===================================================================
--- VCLTee.TeeProcs.pas (revision 315)
+++ VCLTee.TeeProcs.pas (working copy)
@@ -1813,6 +1813,7 @@
if (not Assigned(InternalCanvas)) or (tmpClass<>InternalCanvas.ClassType) then
begin
+ InternalCanvas.Free;
InternalCanvas:=tmpClass.Create;
InternalCanvas.ReferenceCanvas:=FDelphiCanvas;
end;
I'm using 2013 Pro +src version of VCLTee
Good luck
Vasek