TFolder Ownership

Hi there,
obviously I have a fundamental lack of understanding TFolder objects. Attached you will find a small file hopefully explaining what is going wrong. The idea is to create a TFolder object, feed it with stuff derived from TObject (or further TFolders) and eventually dump it to a TFile. However, already at the filling level I am stuck. I tried to ready the documentation carefully but it didn’t help much. Is the problem related to ownership issues, or is it a more fundamental issue?
Help would be appreciated a lot.

Andreas

test.C (2.29 KB)

http://root.cern.ch/download/doc/10FoldersTasks.pdf
http://root.cern.ch/download/doc/8ObjectOwnership.pdf

Hi,

I have found the problem. It is a stupid bug an my side. I have done a shallow copy instead of a deep copy at some point in the example, which resulted in the crash since some stuff went out of scope.

Sorry.