Hi Matevz, this bug has been fixed now in the cvs version. Cheers, Fons. On Mon, 2004-03-29 at 13:01, Matevz Tadel wrote: > Hi, > > The following sequence causes segv with 4.00/03: > > root [0] TMatrixF m(2,2) > root [1] TBuffer b(TBuffer::kWrite) > root [2] m.Streamer(b) > root [3] b.SetReadMode() > root [4] b.SetBufferOffset(0) > root [5] TMatrixF n(2,2) // If default ctor is used it works fine. > root [6] n.Streamer(b) > > *** Break *** segmentation violation > > I traced it down to a leftover from the TMatrixF/D::Clear() method, > which is also called from the Streamer(). By adding 'fElements = 0;' to > Clear(), everything is fine. A patch with the above fix is attached. > > I'm not exactly sure in what ways the Clear() method is used ... perhaps > a more elaborate fix is needed. > > Cheers, > Matevz > > ______________________________________________________________________ > > Common subdirectories: root.403.src.orig/matrix/inc/CVS and root.403.src/matrix/inc/CVS > diff -u root.403.src.orig/matrix/inc/TMatrixD.h root.403.src/matrix/inc/TMatrixD.h > --- root.403.src.orig/matrix/inc/TMatrixD.h 2004-03-21 11:52:27.000000000 +0100 > +++ root.403.src/matrix/inc/TMatrixD.h 2004-03-26 18:34:47.000000000 +0100 > @@ -77,7 +77,11 @@ > virtual const Double_t *GetMatrixArray () const; > virtual Double_t *GetMatrixArray (); > > - virtual void Clear(Option_t * /*option*/ ="") { if (fIsOwner) Delete_m(fNelems,fElements); fNelems = 0; } > + virtual void Clear(Option_t * /*option*/ ="") { > + if (fIsOwner) Delete_m(fNelems,fElements); > + fElements = 0; > + fNelems = 0; > + } > > void Use (Int_t nrows,Int_t ncols,Double_t *data); > void Use (Int_t row_lwb,Int_t row_upb, > diff -u root.403.src.orig/matrix/inc/TMatrixF.h root.403.src/matrix/inc/TMatrixF.h > --- root.403.src.orig/matrix/inc/TMatrixF.h 2004-03-21 11:52:27.000000000 +0100 > +++ root.403.src/matrix/inc/TMatrixF.h 2004-03-26 18:34:42.000000000 +0100 > @@ -78,7 +78,11 @@ > virtual const Float_t *GetMatrixArray () const; > virtual Float_t *GetMatrixArray (); > > - virtual void Clear(Option_t * /*option*/ ="") { if (fIsOwner) Delete_m(fNelems,fElements); fNelems = 0; } > + virtual void Clear(Option_t * /*option*/ ="") { > + if (fIsOwner) Delete_m(fNelems,fElements); > + fElements = 0; > + fNelems = 0; > + } > > void Use (Int_t nrows,Int_t ncols,Float_t *data); > void Use (Int_t row_lwb,Int_t row_upb, -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://www.rademakers.org/fons/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET