Re: Funny ROOT session: *** Break *** segmentation violation

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Fri, 22 Feb 2008 09:33:11 +0100


Hi Vassili,

the reason is that P.Draw() makes C own P. Think of a TLine::Draw() which will delete the TLine when the canvas is deleted it is drawn on.

CINT on the other hand also tried to destruct the object it created in "TPad P" when exiting. Jut like it destructs C. Now you have both CINT and the TCanvas deleting the same object: bad. Instead do TPad* P = new TPad(); that way, CINT doesn't destruct it when cleaning up its "stack".

Cheers, Axel

Vassili Maroussov wrote:
> Dear ROOTers,
>
> what can be a reason for a segmentation violation in the funny ROOT
> session below?
>
> Regards,
>
> Vassili
> _________________________________________
>
> [pcmspur5] ~/FieldMapping/PlainCPP > root -l
>
> Welcome to the ROOT tutorials
>
>
> Type ".x demos.C" to get a toolbar from which to execute the demos
>
> Type ".x demoshelp.C" to see the help window
>
> ==> Many tutorials use the file hsimple.root produced by hsimple.C
> ==> It is recommended to execute hsimple.C before any other script
>
> root [0] gROOT->GetVersion()
> (const char* 0x8266620)"5.18/00"
> root [1] TPad P
> root [2] TCanvas C
> root [3] P.Draw()
> root [4] .q
>
> *** Break *** segmentation violation
> (no debugging symbols found)
> Using host libthread_db library "/lib/tls/libthread_db.so.1".
> Attaching to program: /proc/16349/exe, process 16349
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> [Thread debugging using libthread_db enabled]
> [New Thread -1218574560 (LWP 16349)]
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
>
> 0x00df951e in __waitpid_nocancel () from /lib/tls/libc.so.6
> Thread 1 (Thread -1218574560 (LWP 16349)):
> #0 0x00df951e in __waitpid_nocancel () from /lib/tls/libc.so.6
> #1 0x00d8e1d4 in do_system () from /lib/tls/libc.so.6
> #2 0x00866d7f in system () from /lib/tls/libpthread.so.0
> #3 0x002d4f8f in TUnixSystem::Exec () from /cern/ROOT/5.18/lib/libCore.so
> #4 0x002d53af in TUnixSystem::StackTrace () from
> /cern/ROOT/5.18/lib/libCore.so
> #5 0x002d323d in TUnixSystem::DispatchSignals () from
> /cern/ROOT/5.18/lib/libCore.so
> #6 0x002d136d in SigHandler () from /cern/ROOT/5.18/lib/libCore.so
> #7 0x002d7d31 in sighandler () from /cern/ROOT/5.18/lib/libCore.so
> #8 <signal handler called>
> #9 0x006dc3e8 in vtable for TString () from /cern/ROOT/5.18/lib/libCore.so
> #10 0x00cd675a in TPad::Close () from /cern/ROOT/5.18/lib/libGpad.so
> #11 0x00cd4e14 in TPad::~TPad$delete () from /cern/ROOT/5.18/lib/libGpad.so
> #12 0x00cffe18 in G__G__GPad_147_0_228 () from
> /cern/ROOT/5.18/lib/libGpad.so
> #13 0x0093562b in Cint::G__ExceptionWrapper () from
> /cern/ROOT/5.18/lib/libCint.so
> #14 0x009de44d in G__call_cppfunc () from /cern/ROOT/5.18/lib/libCint.so
> #15 0x009ccb2d in G__interpret_func () from /cern/ROOT/5.18/lib/libCint.so
> #16 0x009b6ee0 in G__getfunction () from /cern/ROOT/5.18/lib/libCint.so
> #17 0x00a2220f in G__destroy_upto_vararray () from
> /cern/ROOT/5.18/lib/libCint.so
> #18 0x00a2253b in G__destroy_upto () from /cern/ROOT/5.18/lib/libCint.so
> #19 0x00a230af in G__scratch_globals_upto () from
> /cern/ROOT/5.18/lib/libCint.so
> #20 0x002a7745 in TCint::ResetGlobals () from
> /cern/ROOT/5.18/lib/libCore.so
> #21 0x00216e1d in TApplication::ProcessLine () from
> /cern/ROOT/5.18/lib/libCore.so
> #22 0x00781009 in TRint::HandleTermInput () from
> /cern/ROOT/5.18/lib/libRint.so
> #23 0x0077f858 in TTermInputHandler::Notify () from
> /cern/ROOT/5.18/lib/libRint.so
> #24 0x00781a9e in TTermInputHandler::ReadNotify () from
> /cern/ROOT/5.18/lib/libRint.so
> #25 0x002d35d3 in TUnixSystem::CheckDescriptors () from
> /cern/ROOT/5.18/lib/libCore.so
> #26 0x002d2960 in TUnixSystem::DispatchOneEvent () from
> /cern/ROOT/5.18/lib/libCore.so
> #27 0x0026c200 in TSystem::InnerLoop () from /cern/ROOT/5.18/lib/libCore.so
> #28 0x0026bfda in TSystem::Run () from /cern/ROOT/5.18/lib/libCore.so
> #29 0x00217f6a in TApplication::Run () from /cern/ROOT/5.18/lib/libCore.so
> #30 0x0078095a in TRint::Run () from /cern/ROOT/5.18/lib/libRint.so
> #31 0x080488be in main ()
> Root > .q
>
> This is the end of ROOT -- Goodbye
>
> [pcmspur5] ~/FieldMapping/PlainCPP >
>
>
Received on Fri Feb 22 2008 - 09:33:25 CET

This archive was generated by hypermail 2.2.0 : Fri Feb 22 2008 - 11:50:01 CET