tutorials/eve/histobrowser.C macros segmentation fault

Hello,

In root 5.31/01, if I run histobrowser in interpreted mode:

It loads fine and I can double click on histograms and have them drawn in the HLT Canvas tab. However if I try to run one of the macros by double clicking on it I receive a segmentation fault. Same thing happens if I drag a macro to the TCanvas.

If one adds a new macro to the browser:

m = new TMacro; m->AddLine("{ cout << g_hlt_canvas->GetName() << endl;}"); m->SetName("Debug"); g_hlt_browser->Add(m);

It stil segmentation faults. If instead I just print out the value of the pointer, it no longer 0 (line 7 initializes it to this); perhaps somehow it isn’t properly initialized to the gPad (as is done in line 77 after gSystem creates the TCanvas?).

Hi,

Do you still have this problem with the production release (v5.32) or the trunk?

Philippe.

Hi Philippe,

I just tried it in v5.33/01, and I did not get a seg fault, instead it alerts me that it cannot find the macro. I believe this was because I ran it from my tutorials directory without write permissions. Running from my home directory, double clicking yields again a segmentation fault (output below). If I had to guess without doing more digging, I would say it’s somewhere in the ProcessLine, since when it can’t write the macro before running, it doesn’t seg fault. Let me know if you would like any more information.

Thanks,

Joe

[code]root [0]
Processing histobrowser.C…
root [1]
*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x000000314509a115 in waitpid () from /lib64/libc.so.6
#1 0x000000314503c481 in do_system () from /lib64/libc.so.6
#2 0x00002ae55ab269c2 in TUnixSystem::StackTrace() ()
from /usr/local/root_v5.33/lib/libCore.so
#3 0x00002ae55ab2383a in TUnixSystem::DispatchSignals(ESignals) ()
from /usr/local/root_v5.33/lib/libCore.so
#4
#5 0x00002ae55ac5b479 in G__G__Base2_10_0_9(G__value*, char const*, G__param*, int) () from /usr/local/root_v5.33/lib/libCore.so
#6 0x00002ae55b2ce71d in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) ()
from /usr/local/root_v5.33/lib/libCint.so
#7 0x00002ae55b37fb80 in G__execute_call ()
from /usr/local/root_v5.33/lib/libCint.so
#8 0x00002ae55b3844fa in G__call_cppfunc ()
from /usr/local/root_v5.33/lib/libCint.so
#9 0x00002ae55b35a4fb in G__interpret_func ()
from /usr/local/root_v5.33/lib/libCint.so
#10 0x00002ae55b34995e in G__getfunction ()
from /usr/local/root_v5.33/lib/libCint.so
#11 0x00002ae55b439816 in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /usr/local/root_v5.33/lib/libCint.so
#12 0x00002ae55b42f616 in G__getvariable ()
from /usr/local/root_v5.33/lib/libCint.so
#13 0x00002ae55b31c71f in G__getitem ()
from /usr/local/root_v5.33/lib/libCint.so
#14 0x00002ae55b326eb1 in G__getexpr ()
from /usr/local/root_v5.33/lib/libCint.so
#15 0x00002ae55b3aecaf in G__exec_statement ()
from /usr/local/root_v5.33/lib/libCint.so
#16 0x00002ae55b3087c5 in G__exec_tempfile_core ()
from /usr/local/root_v5.33/lib/libCint.so
#17 0x00002ae55b308afb in G__exec_tempfile ()
from /usr/local/root_v5.33/lib/libCint.so
#18 0x00002ae55b3c1224 in G__process_cmd ()
from /usr/local/root_v5.33/lib/libCint.so
#19 0x00002ae55aae059d in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/local/root_v5.33/lib/libCore.so
#20 0x00002ae55aae0073 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /usr/local/root_v5.33/lib/libCore.so
#21 0x00002ae55aa3d2be in TApplication::ExecuteFile(char const*, int*, bool) ()
from /usr/local/root_v5.33/lib/libCore.so
#22 0x00002ae55aa3a85d in TApplication::ProcessLine(char const*, bool, int*) ()
from /usr/local/root_v5.33/lib/libCore.so
#23 0x00002ae55aa81e42 in TROOT::ProcessLine(char const*, int*) ()
from /usr/local/root_v5.33/lib/libCore.so
#24 0x00002ae55aa6204e in TMacro::Exec(char const*, int*) ()
from /usr/local/root_v5.33/lib/libCore.so
#25 0x00002ae55aa61e79 in TMacro::Browse(TBrowser*) ()
from /usr/local/root_v5.33/lib/libCore.so
#26 0x00002ae55e1e9a42 in TGFileBrowser::DoubleClicked(TGListTreeItem*, int) ()
from /usr/local/root_v5.33/lib/libGui.so
#27 0x00002ae55e5d2863 in G__G__Gui3_401_0_23(G__value*, char const*, G__param*, int) () from /usr/local/root_v5.33/lib/libGui.so
#28 0x00002ae55b3003f0 in Cint::G__CallFunc::Execute(void*) ()
from /usr/local/root_v5.33/lib/libCint.so
#29 0x00002ae55aaddc6c in TCint::CallFunc_Exec(void*, void*) const ()
from /usr/local/root_v5.33/lib/libCore.so
#30 0x00002ae55aa76d8b in TQConnection::ExecuteMethod(long*, int) ()
from /usr/local/root_v5.33/lib/libCore.so
#31 0x00002ae55aa7c85e in TQObject::Emit(char const*, long*) ()
from /usr/local/root_v5.33/lib/libCore.so
#32 0x00002ae55e22bd73 in TGListTree::DoubleClicked(TGListTreeItem*, int) ()
from /usr/local/root_v5.33/lib/libGui.so
#33 0x00002ae55e22f198 in TGListTree::HandleDoubleClick(Event_t*) ()
from /usr/local/root_v5.33/lib/libGui.so
#34 0x00002ae55e202c9f in TGFrame::HandleEvent(Event_t*) ()
from /usr/local/root_v5.33/lib/libGui.so
#35 0x00002ae55e1c99bb in TGClient::HandleEvent(Event_t*) ()
from /usr/local/root_v5.33/lib/libGui.so
#36 0x00002ae55e1c9cc1 in TGClient::ProcessOneEvent() ()
from /usr/local/root_v5.33/lib/libGui.so
#37 0x00002ae55e1c9d3d in TGClient::HandleInput() ()
from /usr/local/root_v5.33/lib/libGui.so
#38 0x00002ae55e1c9d5d in TGInputHandler::Notify() ()
from /usr/local/root_v5.33/lib/libGui.so
#39 0x00002ae55ab23e68 in TUnixSystem::DispatchOneEvent(bool) ()
from /usr/local/root_v5.33/lib/libCore.so
#40 0x00002ae55aa99166 in TSystem::InnerLoop() ()
from /usr/local/root_v5.33/lib/libCore.so
#41 0x00002ae55aa9c3f1 in TSystem::Run() ()
from /usr/local/root_v5.33/lib/libCore.so
#42 0x00002ae55aa38e9f in TApplication::Run(bool) ()
from /usr/local/root_v5.33/lib/libCore.so
#43 0x00002ae55bc2477f in TRint::Run(bool) ()
from /usr/local/root_v5.33/lib/libRint.so
#44 0x0000000000400ffd in main ()

The crash is most likely caused by a problem in your script.
Try to compile it (.L myscript.C+g) and fix any errors.
If that does not help then please submit a bug report at
http://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.[/code]

Hi,

It turns out the assignment to cint global g_hlt_histo_browser does not work as it should. A simplified version seems to work:
root.cern.ch/viewvc/trunk/tutori … hrev=43063

Thanks for reporting the problem!

Cheers,
Matevz

Hi,

this seems to the same problem as in this post of Tue, 21 Feb 2011:

TPad pp=(TPad)gPad with CINT (5.32.00)

In 5.32.00 CINT cant correctly cast “gPad”.

Cheers
Otto

Hi,

A priori the v5.32 problem with gPad is solved in the trunk and in the v5.32 patch branch.

Cheers,
Philippe.