Page 1 of 1

Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

Posted: Wed Jun 19, 2013 11:49 am
by 16565995
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

Re: Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

Posted: Wed Jun 19, 2013 4:01 pm
by 16564359
Thanks Vasek,

this also solves the problem I have reported in my post http://www.teechart.net/support/viewtop ... =3&t=14131

Uli

Re: Memory leak patch for TCustomTeePanel.CreateDefaultCanvas

Posted: Fri Jun 21, 2013 7:09 am
by narcis
Hello Vasek,

Thanks. Yes, you are right. We already had fixed that in our internal sources for the next release.