Hi Christian, the TGString passed to TGLabel should not be deleted by you since it is adopted (and deleted) by the TGLabel (see TGLabel ctor description). Also typically the TGText at al are embedded and managed by their appropriate widgets and need not be garbadge collected by you. Cheers, Fons. "cstrato@EUnet.at" wrote: > > Dear Rooters > > To prevent memory leaks caused by e.g.: > fFrame->AddFrame(new TGLabel(fFrame,new TGString("Author Name:")), > new TGLayoutHints(kLHintsTop | kLHintsLeft)); > > I converted this line to: > fCleanup = new TList; > vL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft); > fCleanup->Add(vL1); > TGString *vStr = new TGString("Author Name:"); > fCleanup->Add(vStr); > TGLabel vLab = new TGLabel(fFrame,vStr); > fCleanup->Add(vLab); > fFrame->AddFrame(vLab, vL1); > > Sorrowly, I cannot add TGString to fCleanup since it is not derived > from TObject. > > Is there a certain reason, why TGString, TGText and TGTextBuffer > are not derived from TObject? Is it possible to change this? > > Thank you in advance > > Best regards > Christian > ---------------------------------- > C.h.r.i.s.t.i.a.n S.t.r.a.t.o.w.a > V.i.e.n.n.a, A.u.s.t.r.i.a -- 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 7677910
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET