RE: Segmentation violation at TPad::Print("*.gif") for THStack

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Mon, 3 Oct 2005 13:19:27 +0200


This now fixed in cvs head. Thanks to have reported it O.C

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910

E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22
7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22
7670300

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Hajime Nanjo
Sent: Monday, October 03, 2005 10:51 AM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] Segmentation violation at TPad::Print("*.gif") for
THStack

Dear ROOTers,

A segmentation vaiolation is occured at
TPad::Print("*.gif") in a batch mode for ROOT v4.04.02.

A script, "hstack.C", includes THStack object and
gPad->Print("hstack.gif").
When it is run from CINT as ".x hstack.C", there is no problem, but when
it is run in batch mode as "root -b hstack.C", a segmentation vaiolation
is occured.
(For the case of ROOT v4.02, it just prints warning message and  give up
creating a gif file.)

Could you please fix to avoid the segmentation violation?

Best Regards,
Hajime
--------------------------------------------

More detailed explanations are described below.
(ROOT version, source code, error messages, behavior in some cases)

=====================================================
1. ROOT version is v4.04.02 in slc3
=====================================================
lxplus016:~$ uname -a
Linux lxplus016.cern.ch 2.4.21-32.0.1.EL.cernsmp #1 SMP Thu May 26
12:29:50 CEST 2005 i686 i686 i386 GNU/Linux lxplus016:~$ gcc -v Reading
specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502
(Red Hat Linux 3.2.3-52) lxplus016:~$ echo $ROOTSYS

/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root
lxplus016:~$ ===================================================== 2. source code =====================================================
//
{ THStack *hs = new THStack("hs","test stacked histograms"); TH1F *h1 = new TH1F("h1","test hstack",100,-4,4); h1->FillRandom("gaus",20000); h1->SetFillColor(kRed); h1->SetMarkerStyle(21); h1->SetMarkerColor(kRed); hs->Add(h1); TH1F *h2 = new TH1F("h2","test hstack",100,-4,4); h2->FillRandom("gaus",15000); h2->SetFillColor(kBlue); h2->SetMarkerStyle(21); h2->SetMarkerColor(kBlue); hs->Add(h2); TH1F *h3 = new TH1F("h3","test hstack",100,-4,4); h3->FillRandom("gaus",10000); h3->SetFillColor(kGreen); h3->SetMarkerStyle(21); h3->SetMarkerColor(kGreen); hs->Add(h3); hs->Draw(); gPad->Print("hstack.gif"); gPad->Print("hstack.ps"); } ===================================================== 3. error messages ===================================================== root [0] Processing hstack.C... <TCanvas::MakeDefCanvas>: created default TCanvas with name c1 *** Break *** segmentation violation Generating stack trace... 0x028e1ab3 in TImageDump::DrawPS(int, double*, double*) + 0x513 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libPostscript.so
0x00f47bc6 in TPad::PaintFillArea(int, double*, double*, char const*) + 0x3f0 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00cc67a2 in TGraph::PaintGrapHist(int, double const*, double const*, char const*) + 0x122a from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGraf.so
0x05ca713f in THistPainter::PaintHist(char const*) + 0xce7 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libHistPainter.so
0x05c9f149 in THistPainter::Paint(char const*) + 0x56f from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libHistPainter.so
0x00841387 in TH1::Paint(char const*) + 0x5d from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libHist.so
0x0086f039 in THStack::Paint(char const*) + 0xd7d from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libHist.so
0x00f460ec in TPad::Paint(char const*) + 0x132 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00f2a767 in TCanvas::Paint(char const*) + 0x2b from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00f4a6b7 in TPad::Print(char const*, char const*) + 0x9a1 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00f4bc85 in TPad::SaveAs(char const*) + 0x50f from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00f49d11 in TPad::Print(char const*) const + 0x15 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00f67def in <unknown> from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libGpad.so
0x00a96d5f in G__call_cppfunc + 0x2ad from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a86204 in G__interpret_func + 0x70d from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a6db03 in G__getfunction + 0x1334 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00af8f9b in G__getstructmem + 0x82a from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00af22e3 in G__getvariable + 0x4d6 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a64dd0 in G__getitem + 0x4ea from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a64fc6 in G__getitem + 0x6e0 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a63af9 in G__getexpr + 0x7065 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00aadde2 in G__exec_function + 0x1d5 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00ab4aae in G__exec_statement + 0x23eb from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a4cc6b in G__exec_tempfile_core + 0x2ce from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00a4ce75 in G__exec_tempfile + 0x22 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x00abc93b in G__process_cmd + 0x4181 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCint.so
0x002b1b89 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xa9 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCore.so
0x002b1c96 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) + 0x46 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCore.so
0x0020bd64 in TApplication::ProcessFile(char const*, int*) + 0x8b6 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCore.so
0x0020b432 in TApplication::ProcessLine(char const*, bool, int*) + 0x5f8 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libCore.so
0x009ccc47 in TRint::Run(bool) + 0x215 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/lib/libRint.so
0x080488dd in main + 0x71 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/bin/root.exe
0x05ae078a in __libc_start_main + 0xda from /lib/tls/libc.so.6 0x080487e1 in _Unwind_Resume + 0x31 from
/afs/cern.ch/sw/root/v4.04.02/slc3_gcc3.2.3/root/bin/root.exe
Root > ===================================================== 4. behavior in some cases ===================================================== case 1 : root [0] .x hstack.C OK case 2 : root -b hstack.C Segmentation violation case 3 : if only TH1 is used in a script, there is no problem. for example,
//
{ TH1F *h1 = new TH1F("h1","test hstack",100,-4,4); h1->FillRandom("gaus",20000); h1->SetFillColor(kRed); h1->SetMarkerStyle(21); h1->SetMarkerColor(kRed); h1->Draw(); gPad->Print("hsimple.gif"); gPad->Print("hsimple.ps"); }
Received on Mon Oct 03 2005 - 13:19:38 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET