Hi Robert, Your analysis is correct. TNode::SetParent was not doing the complete job. Your fix is OK. I introduced it into the current CVS head. Thanks for this report. Rene Brun Robert Hatcher wrote: > > Hi, > Currently in TNode.h there is the declaration & definition for the > method to change a TNode's parent, e.g.: > > virtual void SetParent(TNode *parent) {fParent=parent;} > > But this does only half the work necessary. The parent losing the > custody battle is never informed and continues to think they have > this child. I think the right code is: > > void TNode::SetParent(TNode *parent) > { > // set the pointer to the parent, keep parents informed about who they have > > if (fParent) fParent->GetListOfNodes()->Remove(this); > else gGeometry->GetListOfNodes()->Remove(this); > > fParent = parent; > > if (fParent) { > fParent->BuildListOfNodes(); // new parent might not have list > fParent->GetListOfNodes()->Add(this); > } > else gGeometry->GetListOfNodes()->Add(this); > } > > Could this be the distributed definition? There are times when > building a geometry it's easier to build a "containee" node before > one builds the "container" node and then after the fact make > the right adjustments. > > Thanks, > -robert > > Robert W. Hatcher | rhatcher@slac.stanford.edu > Research Associate | 650.926.3171 [FAX 4001 or 3587] > Stanford University | PO Box 4349, MS #63, Stanford CA 94309
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:58 MET