RE: [ROOT] bug in TObjArray streamer

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Mar 05 2002 - 17:53:44 MET


Hi Corey,

Thank you for reporting this problem.  It will be fixed shortly.

> Was there a reason for this change?

Yes.  The intention was to avoid saving non-used slots, however
the new code forgot the take in consideration the lower bound.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Corey Reed
Sent: Tuesday, March 05, 2002 10:33 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] bug in TObjArray streamer



There appears to be a bug in the streamer of TObjArray in root 3. The
following code works in root 2.25 but crashes in root 3.

{
// make object array: 10 entries, index 5 to 15
TObjArray* oa = new TObjArray(10,5);
for (Int_t i=0; i<10; i++) {
  TObject* o = new TObject();
  oa->Add(o);
}

// write to file and crash
TFile f("test.root","recreate");
f.cd();
oa->Write("array",TObject::kSingleKey);
f.Close();
}

Changing the line in TObjArray::Streamer (root3) from

 nobjects = GetLast()+1;

back to what it was in root2.25

 nobjects = GetSize();

Should fix the problem.

Was there a reason for this change?



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:44 MET