[ROOT] folders and owners

From: Pasha Murat (630)840-8237@169G ((630)840-8237@169G)
Date: Fri Aug 09 2002 - 19:37:09 MEST


Dear ROOT'ers, 

I have a question related to the ownership of the objects attached to the 
folders. If I read the documentation correctly, in the following example
--------------------------------
#include "TH1.h"
#include "TFolder.h"
#include "TProfile.h"

void c() {
  TFolder* fol = gROOT->GetRootFolder()->AddFolder("Ana","StnAna folder");
  TH1::AddDirectory(0);
  TProfile* hist = new TProfile("a","a",500,110000,160000,0,1e10);
  fol->Add(hist);

  delete fol;
  delete hist;  // commenting this line out helps
}
-------------------------------
it is user's responsibility to delete histogram 'hist' created in the 
beginning of the job. Experimentally, however, deletion of the folder 
also deletes the histogram 'hist' added to it.
-------------------------------- 
root [0] .L c.C+
Info in <ACLiC>: creating shared library /home/murat/4.5.0/./c_C.so
root [1] c()
Warning in <TObjectTable::Remove>: 0x088ef980 not found at 9264
root [2] .q

................. at this point manual [and platform-dependent] user intervention 
                   is required...

 *** Break *** keyboard interrupt FILE: LINE:0
---------------------------------

I'd appreciate any comment on what I'm missing. thanks, Pasha

P.S. I'm using ROOT 3.03/07



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET