Hi,
I open a file and use the “Get” method to load an object from that file. I then want to close the file, but don’t want the object to be deleted, so I just use the TDirectory::GetList()->Remove(obj) to remove it from the directory list. As a result the object is not deleted.
But how dangerous is this? For example, if that object is a histogram then its fDirectory will still point to the (now closed) file. Are there operations one would normally perform on the histogram that will try to use fDirectory? A quick look at the source file for a histo makes me think now, but the GetDirectory() call on this histogram means anyone can use it.
Cheers,
Gordon.