Hi Mike, We posted a note at http://root.cern.ch/root/ObjectOwnership.pdf as a response to several questions like yours. Please read this note. I do not understand, in your case, why you want or have to make tests like IsA() == TXXX::Class() ? Rene Brun Mike Kordosky wrote: > > Hi, > > I wrote to this mailing list a month or so ago about removing TObjects > from a file. It was suggested that I do the following: > > // obj is preexisting and derived from TObject > > gDirectory->GetList()->Remove(obj); > > This does indeed remove the objects, so that when I close the file, they > are not deleted. However, there is an addtional snag. If my object > derives from TH1, then when ~TH1() is eventually called, it looks at > TH1::fDirectory. If fDirectory != 0 , it tries to remove the object from > its directory, (which doesn't exist). I know how to remove a histogram > from a directory via TH1::SetDirectory(), but TH1 seems to be a very > special case (along with TTree maybe?) where this is step is needed. Is > there any way around this, besides lots of IsA == > TXXX::Class() statements? If not, are there other classes that have > similar caveats? > > mike kordosky
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:41 MET