Re: [ROOT] bug in TObjArray streamer

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Mar 05 2002 - 17:59:33 MET


Fix now in CVS.

Cheers, Fons.



On Tue, 2002-03-05 at 17:32, 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?
-- 
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 7679480



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