Re: [ROOT] Possible bug in TFile.cxx

From: Jiri Masik (Jiri.Masik@cern.ch)
Date: Wed Jul 31 2002 - 18:03:14 MEST


Joseph Tuggle <jtuggle@fnal.gov> writes:

> Hello,
> 
> I'm writing a program that uses the TFile class to write out some 
> histograms and other ROOT objects. My program goes something like this:
> 
> TFile outputFile("output.root", "recreate");
> // All my code
> outputFile.Write();
> outputFile.Close();
> 
> However, I get a segmentation fault when I try to close the file. I 
> traced the fault to the statement surrounded by asterisks below in 
> TFile.cxx (I included the rest for context):
> 
>    // Delete free segments from free list (but don't delete list header)
>    if (fFree) {
>       fFree->Delete();
>    }
> 
>    if (IsOpen()) {
>       SysClose(fD);
>       fD = -1;
>    }
> 
>    fWritable = kFALSE;
> 
>    if (cursav)
>       cursav->cd();
>    else {
>       gFile      = 0;
> ***   gDirectory = gROOT; ***
>    }
> 
> When it reaches this statement, it tells me the problem is with this 
> line from Class TIter in TCollection.h:
> 
>    TIter(const TCollection *col, Bool_t dir = kIterForward)
>         : fIterator(col ? col->MakeIterator(dir) : 0) { }
> 
> Any ideas?
> 
> Thanks!
> Joe
> 

Hi Joe,

do you run anything like
root [0] TFile outputFile("output.root", "recreate");
root [1] TH1F b("h1","",10,0.,1.)
root [2] outputFile.Write()  
root [3] outputFile.Close() 
root [4] .q
?

I'm getting a segfault after .q too.

It seems that the histogram is destructed twice once when the file is
closed and second when global objects are cleaned up.
I have the current CVS sources, Debian/Linux/ppc. It is reproduucible
on lxplus too. 
cheers
-- 
	Jiri



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