Hi Brett, of course you've read the comment above the AddFrame() call in guitest.cxx: // Fill canvas with 256 colored frames (notice that doing it this way // causes a memory leak when deleting the canvas (i.e. the TGFrame's and // TGLayoutHints are NOT adopted by the canvas). // Best is to create a TList and store all frame and layout pointers // in it. When deleting the canvas just delete contents of list. In the method description is says if an object is adopted or just used. For examples of how to cleanup this kind of objects search for fTrash and fCleanup in guitest.cxx. Cheers, Fons. Brett Viren wrote: > > Hi, > > I am trying to understand how to use the TG GUI classes. In > guitest.cxx there is a line: > > fCanvasWindow->AddFrame(new TGFrame(fCanvasWindow->GetContainer(), > 32, 32, 0, (i+1)&255), > new TGLayoutHints(kLHintsExpandY | kLHintsRight)); > > As far as I can see, these TGFrame and TGLayoutHints are never > deleted, is this correct? In other words, is it up to the user to > memory manage objects given to TG GUI classes, or are there cases > where this management is done by the TG GUI classes? > > Thanks, > -Brett. -- 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:40 MET