Hello
I have a problem using a TTree a TObject-derived class.
The structure of the object is admittedly rather complicated:
there are three TObject-derived classes, A, B, and C.
A a1; B b1,b2; C c1;
a1 has a pointer to b1. b1 has a pointer to a1.
a1 has a pointer to c1. c1 has a pointer to a1.
c1 has a pointer to b1.
c1 has a pointer to b2.
all other pointers are null, and for a given use of A, some of the
pointers listed above may also be null (i.e. if c1 hasn't been created yet)
Storing a1 in a TFile works perfectly, with all the pointer structure
preserved and recreated on reading from the file.
However, storing a1 in a branch of a TTree (splitting set to 99) doesn't
work properly.
reading a1 from the TTree results in additional objects being created,
including a duplicate of a1 and a duplicate of b2. Since my destructors
aren't designed to handle a garbled structure like that, this results in
memory leaks on a TTree::Draw() or on looping over the TTree.
Does this sound like a problem with my code? If so, any thoughts as to
what I might have done wrong?
If, as I would like to think, my code works properly (the pointer
structure is correct before I write it to the TTree, and reading from a
TFile works), is this a known problem? If not i'll try to reduce it to
the simplest case and post the code that reproduces the error.
Running 3.05/07 for linuxdeb with gcc 3.3.1
Thanks,
Brant Carlson
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET