Dear root experts,
I’m running on a Mac OS Lion a C++ compiled code with root.
In the main I do:
TApplication* theApp = new TApplication(“Applications”, &argc, argv);
.
.
.
at the end of the main I do:
theApp->Terminate(0);
return 0;
At the instruction theApp->Terminate(0); the program crashes !!!
Can you please help me to make the program ending without crashing ?
Thanks,
Thanks for you answer Wile,
but the program is still crashing even with your suggestion.
One more piece of information: I’m also using ROOFIT in my program.
( maybe this can help the experts to to have a more clear picture of the problem )
The output of the crashing is at the bottom of this message.
Many thanks.
Mauro.
*** Break *** segmentation violation
There was a crash.
This is the entire stack trace of all threads:
Thread 1 (process 57725): #0 0x00007fff8b397168 in wait4 () #1 0x00007fff903935f5 in system () #2 0x000000010f196b16 in TUnixSystem::StackTrace () #3 0x000000010f1948a7 in TUnixSystem::DispatchSignals () #4 #5 0x000000010f14eaf5 in TList::Delete () #6 0x0000000111ed25d7 in RooPlot::~RooPlot () #7 0x0000000111ed24f2 in RooPlot::~RooPlot () #8 0x000000010f14b0b4 in TCollection::GarbageCollect () #9 0x000000010f14c951 in THashList::Delete () #10 0x00000001100b20d4 in TDirectoryFile::Close () #11 0x00000001100bd1e2 in TFile::Close () #12 0x00000001100bbc96 in TFile::~TFile () #13 0x00000001100bbc32 in TFile::~TFile () #14 0x000000010f14b0b4 in TCollection::GarbageCollect () #15 0x000000010f14e9cd in TList::Delete () #16 0x000000010f10385e in TROOT::~TROOT () #17 0x00007fff903d07c8 in __cxa_finalize () #18 0x00007fff903d0652 in exit () #19 0x000000010e6aaaab in start ()
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
#5 0x000000010f14eaf5 in TList::Delete () #6 0x0000000111ed25d7 in RooPlot::~RooPlot () #7 0x0000000111ed24f2 in RooPlot::~RooPlot () #8 0x000000010f14b0b4 in TCollection::GarbageCollect () #9 0x000000010f14c951 in THashList::Delete () #10 0x00000001100b20d4 in TDirectoryFile::Close () #11 0x00000001100bd1e2 in TFile::Close () #12 0x00000001100bbc96 in TFile::~TFile () #13 0x00000001100bbc32 in TFile::~TFile () #14 0x000000010f14b0b4 in TCollection::GarbageCollect () #15 0x000000010f14e9cd in TList::Delete () #16 0x000000010f10385e in TROOT::~TROOT () #17 0x00007fff903d07c8 in __cxa_finalize () #18 0x00007fff903d0652 in exit () #19 0x000000010e6aaaab in start ()
Well, I hate to say it … but … a typical reply here will be … can you try the newest v5-34-00-patches branch
BTW. if it’s really a “RooFit” issue, you’ll probably get help faster on the Stat and Math Tool Support forum.
You can try calling:gROOT->CloseFiles();just before Terminate. If this does not solve the problem, then you ought to run with valgrind to see if there is a double delete or memory overwrite.
Humm … does it fail differently (it can not fail the same or we are missing something essential)? Did you try valgrind? Can you provide a complete running example?
Do ALWAYS make sure that a pointer is NON-NULL, before you try to use it:
You MUST NOT “delete paveTextX;” when it is still used somewhere (e.g. it’s drawn in the canvas).
Honestly speaking, I don’t think “theApp->Terminate(0);” should be there (it can be used in a GUI, with use of the signal/slot mechanism, to terminate the application). But Philippe might bring more light in here.
[quote]3. Honestly speaking, I don’t think “theApp->Terminate(0);” should be there (it can be used in a GUI, with use of the signal/slot mechanism, to terminate the application). But Philippe might bring more light in here.[/quote]That’s correct. However it should also not be a factor in this example working or not …
[quote=“pcanal”]That’s correct. However it should also not be a factor in this example working or not …[/quote] It isn’t. His “paveTextX” pointer is null.