Re: [ROOT] TH1F.BufferEmpty segfaults

From: Rene Brun (brun@pcbrun.cern.ch)
Date: Sat Jun 12 2004 - 16:59:39 MEST


This is now protected in CVS.
However, you should not call this function without having created a 
buffer a priori (via SetBuffer)

Rene Brun

On Fri, 11 Jun 2004, Radim Kolar wrote:

> histogram function bufferEmpty() do not checks if buffer is really used.
> It crashes instead.
> 
> {
>     gROOT->Reset();
> 
>     FILE *f;
>     int i;
>     int n;
>     Float_t tps;
>     TH1F h1;
>  
>     h1=new TH1F("freebsd","FreeBSD  5.2.1",9,1.0,10.0);
>     //h1.Sumw2();
>     h1->SetFillColor(48);
>     f=fopen("freebsd52.txt","r");
>     while(1)
>     {
>         if(EOF==fscanf(f,"%d %f\n",&n,&tps)) break;
>         h1.Fill(n,tps); 
>     }
>     fclose(f);
>     h1.BufferEmpty(1); // segfaults!!!
>     h1.Scale(0.1);
>     h1.Fit("pol4");
>     h1.Draw("");
>     c1 -> SaveAs("bsd5.ps");
> 
> }
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET