Re: [ROOT] bug in TObjArray streamer

From: Maarten Ballintijn (maartenb@mit.edu)
Date: Tue Mar 05 2002 - 17:51:53 MET


Hi,

The correct fix is to change GetLast() to GetAbsLast().

Maarten.


On Tue, Mar 05, 2002 at 11:32:46AM -0500, Corey Reed wrote:
> 
> 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