Hi Damir,
the fontstruct obtained via TGClient::GetFontByName() must be deleted
via TVirtualX::DeleteFont(). I've added a comment in GetFontByName()
that says this.
Cheers, Fons.
On Thu, 2003-03-13 at 17:06, Damir Buskulic wrote:
> Hi,
>
> Why is the following snippet of code leaking ? Did I misunderstood
> something ?
> (This is on MacOSX with v3.05/02 but I doubt it has smthing to do with
> the platform)
>
> {
> for (int i=0;i<1000;i++) {
> FontStruct_t smallLabelFont =
> gClient->GetFontByName("-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-
> iso8859-1");
> TGGC* smallLabelGC = new TGGC(TGLabel::GetDefaultGC());
> smallLabelGC->SetFont(gVirtualX->GetFontHandle(smallLabelFont));
> delete smallLabelGC;
gVirtualX->DeleteFont(smallLabelFont); // removes the leak
> }
> }
>
> Cheers
>
> Damir
>
> ====================================
> Damir Buskulic, Universite de Savoie/LAPP
> Chemin de Bellevue, B.P. 110, F-74941 Annecy-le-Vieux Cedex, FRANCE
> Tel : +33 (0)450091600
> e-mail: buskulic@lapp.in2p3.fr
> ====================================
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET