Hi George, could you mail me your class and the exact statements so I can reproduce the problem easily locally. Cheers, Fons. > > Hi, > > I was trying to use TObject::Clone() to copy an object which included a TArrayF, which gave me the following messages twice, followed somewhat later by a segmentation violation. > > Error in <TExMap::Add>: key 2 is not unique > > I tracked it back to TBuffer::ReadClass, appended (in edited form) below. My comments are noted with //** at the left. Is this a bug or am I missing something? I'm using 2.22/10 on RedHat 6.0. And is this likely to be causing my Segvio later on? > > TClass *TBuffer::ReadClass(const TClass *clReq, UInt_t *objTag) > { > [...] > > // read byte count and/or tag (older files don't have byte count) > UInt_t bcnt, tag, startpos = 0; > *this >> bcnt; > if (!(bcnt & kByteCountMask) || bcnt == kNewClassTag) { > tag = bcnt; > bcnt = 0; > } else { > fVersion = 1; > startpos = UInt_t(fBufCur-fBuffer); > *this >> tag; > } > //** It appears that this TArrayF at least > //** has bcnt == kNewClassTag = 0xffffffff, so > //** startpos is still zero after this if. > > // in case tag is object tag return tag > if (!(tag & kClassMask)) { > if (objTag) *objTag = tag; > return 0; > } > //** Since tag is now ffffffff, it & kClassMask are true of course, so this is > //** skipped. > > TClass *cl; > if (tag == kNewClassTag) { > > //** It enters here... > > // got a new class description followed by a new object > // (class can be 0 if class dictionary is not found, in that > // case object of this class must be skipped) > cl = TClass::Load(*this); > > // add class to fReadMap for later reference > if (fVersion > 0) { > // check if class was already read > TClass *cl1 = (TClass *)fReadMap->GetValue(startpos+kMapOffset); > //** But startpos is still 0... kMapOffset = 2, so this is is then causing > //** the error message of '2' having multiple readings. This has apparently > //** happened once before already to cause the error message, that I didn't see. > if (cl1 != cl) > MapObject(cl ? cl : (TObject*) -1, startpos+kMapOffset); > } else > MapObject(cl, fMapCount); > > [... rest snipped... ] > > > -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET