Re: [ROOT] problems with TObjArray::Streamer () ???

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Apr 13 2001 - 10:35:48 MEST


Hi Miha,
You are doing an illegal operation in fParNames.AddLast((TObject*)pnm);
You should not add to a TObjArray something that is not a TObject*.
This will give problems later when Cloning.
Why don't you use simply a array of TString (eg see TFormula).

Rene Brun


On Fri, 13 Apr 2001 miha.puc@marvin.fmf.uni-lj.si wrote:

> Hi ROOTers!
> 
> I want to Clone() my class TFoonction and get a Segmentation fault.
> 
> >From debugger I got
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x400d39a5 in TBuffer::WriteObject () from /usr/share/root/lib/libCore.so
> Current language:  auto; currently c
> (gdb) bt
> #0  0x400d39a5 in TBuffer::WriteObject () from
> /usr/share/root/lib/libCore.so
> #1  0x4012320f in TObjArray::Streamer () from
> /usr/share/root/lib/libCore.so
> #2  0x4014686d in TStreamerInfo::WriteBuffer ()
>    from /usr/share/root/lib/libCore.so
> #3  0x4012d66f in TClass::WriteBuffer () from
> /usr/share/root/lib/libCore.so
> #4  0x40b5a624 in TFoonction::Streamer (this=0x86bbb28,
> R(bool)=@0x86c5b30)
>     at TFoonction_Dict.cc:110
> #5  0x400ed404 in TObject::Clone () from /usr/share/root/lib/libCore.so
> #6  0x400ebe75 in TNamed::Clone () from /usr/share/root/lib/libCore.so
> #7  0x40b59c3c in TFoonction::Add (this=0x86bbfb8, Fnc=0x86bbb28,
>     Fname=0x804a5dc "Sline1") at TFoonction.cxx:121
> #8  0x8049278 in SetFoonc () at SetFoonc.cxx:29
> #9  0x8048f97 in main (argc=2, argv=0xbffffc54) at testFoo.C:24
> 
> 
> It seems that TObjArray fParNames is the problem.
> I fill it with the loop below and it works OK otherwise.
> 
>    for (Int_t ij=0; ij<fNprs; ij++) {
>       TString *pnm = new TString(name);
>       *pnm += "_p";
>       *pnm += ij;
>       fParNames.AddLast((TObject*)pnm);
>    }
> 
> 
> Does anyone know where the problem is?
> I use ROOT v3.01/00 on RH 6.2.
> 
> Thank you,
> Miha
> 
> -- 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:41 MET