TEve Segmentation fault at end of program + other questions

Dear ROOT developers,

I am using TEve (which I find really pleasant to work with), but I face one problem: At the end of my program, independently from if I had drawn geometry or markers or anything else before or not I get a seg fault.

I tried to compile the smallest possible example (which you find attached).

When running it, it runs fine until the program stops, then I get a seg-fault.
Output of the program:

./run 

create TApplication
create TEveManager
libGL warning: 3D driver claims to not support visual 0x5b
redraw
pause
Press return to continue ...

last before end
Error in <RootX11ErrorHandler>: BadWindow (invalid Window parameter) (TGedEditor XID: 17826085, XREQ: 10)
TGedEditor:     17826085
        TGCompositeFrame:       17826051
        TEveGListTreeEditorFrame:       17826050

 *** Break *** segmentation violation



===========================================================
There was a crash (kSigSegmentationViolation).
This is the entire stack trace of all threads:
===========================================================
#0  0x00000030b6299d75 in waitpid () from /lib64/libc.so.6
#1  0x00000030b623c331 in do_system () from /lib64/libc.so.6
#2  0x00002ab5ccaf7763 in TUnixSystem::Exec (this=0x1f5bcd30, shellcmd=0x1fe86438 "/afs/cern.ch/sw/lcg/app/releases/ROOT/5.26.00b/x86_64-slc5-gcc43-dbg/root/etc/gdb-backtrace.sh 10260 1>&2")
    at core/unix/src/TUnixSystem.cxx:1978
#3  0x00002ab5ccaf6a47 in TUnixSystem::StackTrace (this=0x1f5bcd30) at core/unix/src/TUnixSystem.cxx:2188
#4  0x00002ab5ccaf9e3d in TUnixSystem::DispatchSignals (this=0x1f5bcd30, sig=kSigSegmentationViolation) at core/unix/src/TUnixSystem.cxx:1106
#5  0x00002ab5ccaf9f60 in SigHandler (sig=kSigSegmentationViolation) at core/unix/src/TUnixSystem.cxx:350
#6  0x00002ab5ccaef694 in sighandler (sig=11) at core/unix/src/TUnixSystem.cxx:3428
#7  <signal handler called>
#8  0x000000001feff450 in ?? ()
#9  0x00002ab5d20f12a1 in TGWindow::Print (this=0x1feacfc8, option=0x2ab5d3fc8654 "tree") at gui/gui/src/TGWindow.cxx:199
#10 0x00002ab5d1ffba20 in TGCompositeFrame::Print (this=0x1feacfc8, option=0x2ab5d3fc8654 "tree") at gui/gui/src/TGFrame.cxx:1229
#11 0x00002ab5d3faa6ad in RootX11ErrorHandler(Display *, <anonymous struct> *) (disp=0x1fcd6940, err=0x7fff550ae710) at graf2d/x11/src/GX11Gui.cxx:189
#12 0x00000030b7e4960f in _XError () from /usr/lib64/libX11.so.6
#13 0x00000030b7e4b0d9 in _XReply () from /usr/lib64/libX11.so.6
#14 0x00000030b7e2d8e5 in _XGetWindowAttributes () from /usr/lib64/libX11.so.6
#15 0x00000030b7e2da58 in XGetWindowAttributes () from /usr/lib64/libX11.so.6
#16 0x00002ab5d3fa82c7 in TGX11::GetWindowAttributes (this=0x1fccb2f0, id=17826687, attr=...) at graf2d/x11/src/GX11Gui.cxx:769
#17 0x00002ab5d20f0b92 in TGWindow::IsMapped (this=0x209eec10) at gui/gui/src/TGWindow.cxx:181
#18 0x00002ab5d1fb67de in TGComboBoxPopup::EndPopup (this=0x209eec10) at gui/gui/src/TGComboBox.cxx:96
#19 0x00002ab5d1fb861d in TGComboBox::~TGComboBox (this=0x209ee580, __in_chrg=<value optimized out>) at gui/gui/src/TGComboBox.cxx:194
#20 0x00002ab5d1ff0268 in TGCompositeFrame::Cleanup (this=0x209ee120) at gui/gui/src/TGFrame.cxx:938
#21 0x00002ab5d1ffcf0e in TGCompositeFrame::~TGCompositeFrame (this=0x209ee120, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:866
#22 0x00002ab5d200142f in TGHorizontalFrame::~TGHorizontalFrame (this=0x209ee120, __in_chrg=<value optimized out>) at include/TGFrame.h:461
#23 0x00002ab5d1ff0268 in TGCompositeFrame::Cleanup (this=0x209edac0) at gui/gui/src/TGFrame.cxx:938
#24 0x00002ab5d1ffcf0e in TGCompositeFrame::~TGCompositeFrame (this=0x209edac0, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:866
#25 0x00002ab5d1ffd16f in TGGroupFrame::~TGGroupFrame (this=0x209edac0, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:2037
#26 0x00002ab5d1ff0268 in TGCompositeFrame::Cleanup (this=0x20936190) at gui/gui/src/TGFrame.cxx:938
#27 0x00002ab5d1ffcf0e in TGCompositeFrame::~TGCompositeFrame (this=0x20936190, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:866
#28 0x00002ab5d20014df in TGVerticalFrame::~TGVerticalFrame (this=0x20936190, __in_chrg=<value optimized out>) at include/TGFrame.h:450
#29 0x00002ab5d2872686 in TGedFrame::~TGedFrame (this=0x2088f270, __in_chrg=<value optimized out>) at gui/ged/src/TGedFrame.cxx:62
#30 0x00002ab5d35a744b in TGLViewerEditor::~TGLViewerEditor (this=0x2088f270, __in_chrg=<value optimized out>) at graf3d/gl/src/TGLViewerEditor.cxx:87
#31 0x00002ab5d286fbda in TGedEditor::~TGedEditor (this=0x1feacfc0, __in_chrg=<value optimized out>) at gui/ged/src/TGedEditor.cxx:157
#32 0x00002ab5d0f87511 in TEveGedEditor::~TEveGedEditor (this=0x1feacfc0, __in_chrg=<value optimized out>) at graf3d/eve/src/TEveGedEditor.cxx:84
#33 0x00002ab5d0f3fee2 in TEveGListTreeEditorFrame::~TEveGListTreeEditorFrame (this=0x1fe9d040, __in_chrg=<value optimized out>) at graf3d/eve/src/TEveBrowser.cxx:205
#34 0x00002ab5cca81f8a in TCollection::GarbageCollect (obj=0x1fe9d040) at core/cont/src/TCollection.cxx:585
#35 0x00002ab5cca85a70 in THashList::Delete (this=0x1fce8730, option=0x2ab5d247658a "slow") at core/cont/src/THashList.cxx:207
#36 0x00002ab5d1fa0a53 in TGClient::~TGClient (this=0x1fcd6840, __in_chrg=<value optimized out>) at gui/gui/src/TGClient.cxx:574
#37 0x00002ab5d20f3548 in TRootApplication::~TRootApplication (this=0x1f8f0e40, __in_chrg=<value optimized out>) at gui/gui/src/TRootApplication.cxx:60
#38 0x00002ab5cc9ca22f in TApplication::~TApplication (this=0x7fff550af110, __in_chrg=<value optimized out>) at core/base/src/TApplication.cxx:204
#39 0x00000000004017c7 in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you 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.
===========================================================
#8  0x000000001feff450 in ?? ()
#9  0x00002ab5d20f12a1 in TGWindow::Print (this=0x1feacfc8, option=0x2ab5d3fc8654 "tree") at gui/gui/src/TGWindow.cxx:199
#10 0x00002ab5d1ffba20 in TGCompositeFrame::Print (this=0x1feacfc8, option=0x2ab5d3fc8654 "tree") at gui/gui/src/TGFrame.cxx:1229
#11 0x00002ab5d3faa6ad in RootX11ErrorHandler(Display *, <anonymous struct> *) (disp=0x1fcd6940, err=0x7fff550ae710) at graf2d/x11/src/GX11Gui.cxx:189
#12 0x00000030b7e4960f in _XError () from /usr/lib64/libX11.so.6
#13 0x00000030b7e4b0d9 in _XReply () from /usr/lib64/libX11.so.6
#14 0x00000030b7e2d8e5 in _XGetWindowAttributes () from /usr/lib64/libX11.so.6
#15 0x00000030b7e2da58 in XGetWindowAttributes () from /usr/lib64/libX11.so.6
#16 0x00002ab5d3fa82c7 in TGX11::GetWindowAttributes (this=0x1fccb2f0, id=17826687, attr=...) at graf2d/x11/src/GX11Gui.cxx:769
#17 0x00002ab5d20f0b92 in TGWindow::IsMapped (this=0x209eec10) at gui/gui/src/TGWindow.cxx:181
#18 0x00002ab5d1fb67de in TGComboBoxPopup::EndPopup (this=0x209eec10) at gui/gui/src/TGComboBox.cxx:96
#19 0x00002ab5d1fb861d in TGComboBox::~TGComboBox (this=0x209ee580, __in_chrg=<value optimized out>) at gui/gui/src/TGComboBox.cxx:194
#20 0x00002ab5d1ff0268 in TGCompositeFrame::Cleanup (this=0x209ee120) at gui/gui/src/TGFrame.cxx:938
#21 0x00002ab5d1ffcf0e in TGCompositeFrame::~TGCompositeFrame (this=0x209ee120, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:866
#22 0x00002ab5d200142f in TGHorizontalFrame::~TGHorizontalFrame (this=0x209ee120, __in_chrg=<value optimized out>) at include/TGFrame.h:461
#23 0x00002ab5d1ff0268 in TGCompositeFrame::Cleanup (this=0x209edac0) at gui/gui/src/TGFrame.cxx:938
#24 0x00002ab5d1ffcf0e in TGCompositeFrame::~TGCompositeFrame (this=0x209edac0, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:866
#25 0x00002ab5d1ffd16f in TGGroupFrame::~TGGroupFrame (this=0x209edac0, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:2037
#26 0x00002ab5d1ff0268 in TGCompositeFrame::Cleanup (this=0x20936190) at gui/gui/src/TGFrame.cxx:938
#27 0x00002ab5d1ffcf0e in TGCompositeFrame::~TGCompositeFrame (this=0x20936190, __in_chrg=<value optimized out>) at gui/gui/src/TGFrame.cxx:866
#28 0x00002ab5d20014df in TGVerticalFrame::~TGVerticalFrame (this=0x20936190, __in_chrg=<value optimized out>) at include/TGFrame.h:450
#29 0x00002ab5d2872686 in TGedFrame::~TGedFrame (this=0x2088f270, __in_chrg=<value optimized out>) at gui/ged/src/TGedFrame.cxx:62
#30 0x00002ab5d35a744b in TGLViewerEditor::~TGLViewerEditor (this=0x2088f270, __in_chrg=<value optimized out>) at graf3d/gl/src/TGLViewerEditor.cxx:87
#31 0x00002ab5d286fbda in TGedEditor::~TGedEditor (this=0x1feacfc0, __in_chrg=<value optimized out>) at gui/ged/src/TGedEditor.cxx:157
#32 0x00002ab5d0f87511 in TEveGedEditor::~TEveGedEditor (this=0x1feacfc0, __in_chrg=<value optimized out>) at graf3d/eve/src/TEveGedEditor.cxx:84
#33 0x00002ab5d0f3fee2 in TEveGListTreeEditorFrame::~TEveGListTreeEditorFrame (this=0x1fe9d040, __in_chrg=<value optimized out>) at graf3d/eve/src/TEveBrowser.cxx:205
#34 0x00002ab5cca81f8a in TCollection::GarbageCollect (obj=0x1fe9d040) at core/cont/src/TCollection.cxx:585
#35 0x00002ab5cca85a70 in THashList::Delete (this=0x1fce8730, option=0x2ab5d247658a "slow") at core/cont/src/THashList.cxx:207
#36 0x00002ab5d1fa0a53 in TGClient::~TGClient (this=0x1fcd6840, __in_chrg=<value optimized out>) at gui/gui/src/TGClient.cxx:574
#37 0x00002ab5d20f3548 in TRootApplication::~TRootApplication (this=0x1f8f0e40, __in_chrg=<value optimized out>) at gui/gui/src/TRootApplication.cxx:60
#38 0x00002ab5cc9ca22f in TApplication::~TApplication (this=0x7fff550af110, __in_chrg=<value optimized out>) at core/base/src/TApplication.cxx:204
#39 0x00000000004017c7 in main ()
===========================================================

the stack trace of my “original” program (when I am only creating the TEveManager without drawing anything) is slightly different, but the symtoms are the same:

 *** Break *** segmentation violation



===========================================================
There was a crash (kSigSegmentationViolation).
This is the entire stack trace of all threads:
===========================================================
#0  0x00000030b6299d75 in waitpid () from /lib64/libc.so.6
#1  0x00000030b623c331 in do_system () from /lib64/libc.so.6
#2  0x00002b94bfc35763 in TUnixSystem::Exec (this=0xd7fdd30, 
    shellcmd=0xebd27e8 "/afs/cern.ch/sw/lcg/app/releases/ROOT/5.26.00b/x86_64-slc5-gcc43-dbg/root/etc/gdb-backtrace.sh 10875 1>&2")
    at core/unix/src/TUnixSystem.cxx:1978
#3  0x00002b94bfc34a47 in TUnixSystem::StackTrace (this=0xd7fdd30)
    at core/unix/src/TUnixSystem.cxx:2188
#4  0x00002b94bfc37e3d in TUnixSystem::DispatchSignals (this=0xd7fdd30, 
    sig=kSigSegmentationViolation) at core/unix/src/TUnixSystem.cxx:1106
#5  0x00002b94bfc37f60 in SigHandler (sig=kSigSegmentationViolation)
    at core/unix/src/TUnixSystem.cxx:350
#6  0x00002b94bfc2d694 in sighandler (sig=11)
    at core/unix/src/TUnixSystem.cxx:3428
#7  <signal handler called>
#8  0x00002b94bfbcf1e6 in TOrdCollection::IndexOf (this=0xd7fe4f0, obj=
    0x2b94c03b0580) at core/cont/src/TOrdCollection.cxx:265
#9  0x00002b94bfbcf4d3 in TOrdCollection::Remove (this=0xd7fe4f0, 
    obj=0x2b94c03b0580) at core/cont/src/TOrdCollection.cxx:376
#10 0x00002b94bfb837b5 in TSystem::RemoveTimer (this=0xd7fdd30, 
    ti=0x2b94c03b0580) at core/base/src/TSystem.cxx:473
#11 0x00002b94bfc3329e in TUnixSystem::RemoveTimer (this=0xd7fdd30, 
    ti=0x2b94c03b0580) at core/unix/src/TUnixSystem.cxx:2809
#12 0x00002b94bfb979af in TTimer::TurnOff (this=0x2b94c03b0580)
    at core/base/src/TTimer.cxx:230
#13 0x00002b94bfb0d7a0 in TTimer::Remove (this=0x2b94c03b0580)
    at include/TTimer.h:91
#14 0x00002b94bfb0db6e in TTimer::~TTimer (this=0x2b94c03b0580, 
    __in_chrg=<value optimized out>) at include/TTimer.h:77
#15 0x00002b94bfb98c20 in TSingleShotCleaner::~TSingleShotCleaner (
    this=0x2b94c03b0580, __in_chrg=<value optimized out>)
    at core/base/src/TTimer.cxx:58
#16 0x00000030b62333a5 in exit () from /lib64/libc.so.6
#17 0x00000030b621d99b in __libc_start_main () from /lib64/libc.so.6
#18 0x0000000000402e99 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
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.
===========================================================
#8  0x00002b94bfbcf1e6 in TOrdCollection::IndexOf (this=0xd7fe4f0, obj=
    0x2b94c03b0580) at core/cont/src/TOrdCollection.cxx:265
#9  0x00002b94bfbcf4d3 in TOrdCollection::Remove (this=0xd7fe4f0, 
    obj=0x2b94c03b0580) at core/cont/src/TOrdCollection.cxx:376
#10 0x00002b94bfb837b5 in TSystem::RemoveTimer (this=0xd7fdd30, 
    ti=0x2b94c03b0580) at core/base/src/TSystem.cxx:473
#11 0x00002b94bfc3329e in TUnixSystem::RemoveTimer (this=0xd7fdd30, 
    ti=0x2b94c03b0580) at core/unix/src/TUnixSystem.cxx:2809
#12 0x00002b94bfb979af in TTimer::TurnOff (this=0x2b94c03b0580)
    at core/base/src/TTimer.cxx:230
#13 0x00002b94bfb0d7a0 in TTimer::Remove (this=0x2b94c03b0580)
    at include/TTimer.h:91
#14 0x00002b94bfb0db6e in TTimer::~TTimer (this=0x2b94c03b0580, 
    __in_chrg=<value optimized out>) at include/TTimer.h:77
#15 0x00002b94bfb98c20 in TSingleShotCleaner::~TSingleShotCleaner (
    this=0x2b94c03b0580, __in_chrg=<value optimized out>)
    at core/base/src/TTimer.cxx:58
#16 0x00000030b62333a5 in exit () from /lib64/libc.so.6
#17 0x00000030b621d99b in __libc_start_main () from /lib64/libc.so.6
#18 0x0000000000402e99 in _start ()
===========================================================


Segmentation fault

… and finally the output when I have drawn my geometry and hits and tracks and so on:

*** Break *** segmentation violation

===========================================================
There was a crash (kSigSegmentationViolation).
This is the entire stack trace of all threads:
===========================================================
#0  0x00000030b6299d75 in waitpid () from /lib64/libc.so.6
#1  0x00000030b623c331 in do_system () from /lib64/libc.so.6
#2  0x00002b14fc450763 in TUnixSystem::Exec (this=0x8d4cd30, 
    shellcmd=0x9e06dd8 "/afs/cern.ch/sw/lcg/app/releases/ROOT/5.26.00b/x86_64-slc5-gcc43-dbg/root/etc/gdb-backtrace.sh 11523 1>&2")
    at core/unix/src/TUnixSystem.cxx:1978
#3  0x00002b14fc44fa47 in TUnixSystem::StackTrace (this=0x8d4cd30)
    at core/unix/src/TUnixSystem.cxx:2188
#4  0x00002b14fc452e3d in TUnixSystem::DispatchSignals (this=0x8d4cd30, 
    sig=kSigSegmentationViolation) at core/unix/src/TUnixSystem.cxx:1106
#5  0x00002b14fc452f60 in SigHandler (sig=kSigSegmentationViolation)
    at core/unix/src/TUnixSystem.cxx:350
#6  0x00002b14fc448694 in sighandler (sig=11)
    at core/unix/src/TUnixSystem.cxx:3428
#7  <signal handler called>
#8  0x00002b14fc3de882 in THashList::RecursiveRemove (this=0x8d68fe0, 
    obj=0x8d68a60) at core/cont/src/THashList.cxx:272
#9  0x00002b14fc35f26a in TObject::~TObject (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at core/base/src/TObject.cxx:147
#10 0x00002b14fc3d58f1 in TCollection::~TCollection (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at include/TCollection.h:73
#11 0x00002b14fc3d5961 in TSeqCollection::~TSeqCollection (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at include/TSeqCollection.h:39
#12 0x00002b14fc3e3ade in TList::~TList (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at core/cont/src/TList.cxx:84
#13 0x00002b14fc383896 in TROOT::~TROOT (this=0x2b14fcbb4760, 
    __in_chrg=<value optimized out>) at core/base/src/TROOT.cxx:520
#14 0x00000030b623368e in __cxa_finalize () from /lib64/libc.so.6
#15 0x00002b14fc31fe16 in __do_global_dtors_aux ()
   from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.26.00b/x86_64-slc5-gcc43-dbg/root/lib/libCore.so
#16 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you 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.
===========================================================
#8  0x00002b14fc3de882 in THashList::RecursiveRemove (this=0x8d68fe0, 
    obj=0x8d68a60) at core/cont/src/THashList.cxx:272
#9  0x00002b14fc35f26a in TObject::~TObject (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at core/base/src/TObject.cxx:147
#10 0x00002b14fc3d58f1 in TCollection::~TCollection (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at include/TCollection.h:73
#11 0x00002b14fc3d5961 in TSeqCollection::~TSeqCollection (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at include/TSeqCollection.h:39
#12 0x00002b14fc3e3ade in TList::~TList (this=0x8d68a60, 
    __in_chrg=<value optimized out>) at core/cont/src/TList.cxx:84
#13 0x00002b14fc383896 in TROOT::~TROOT (this=0x2b14fcbb4760, 
    __in_chrg=<value optimized out>) at core/base/src/TROOT.cxx:520
#14 0x00000030b623368e in __cxa_finalize () from /lib64/libc.so.6
#15 0x00002b14fc31fe16 in __do_global_dtors_aux ()
   from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.26.00b/x86_64-slc5-gcc43-dbg/root/lib/libCore.so
#16 0x0000000000000000 in ?? ()
===========================================================


Segmentation fault

I’m probably missing some line of code somewhere. I would very appreciate any help on this issue.

Besides I have another question:

  • I am drawing BoxSets and I’ve seen the possiblity to create histograms right from TEve with buttons in the “Info” section of the digitSets. These histograms have entries as set with hits->DigitValue(int), the range is from 0 to 1e6 while my entries reach at maximum 15. How can I change the range.
  • Can I add other histograms (with their respective buttons) which I can fill with other values?

thanks,
Peter
test.cxx (1.11 KB)
Makefile.txt (458 Bytes)

Hi Peter,

To properly exit a root application it is best to call TApplication::Terminate(). See example from ALICE event display:
alisoft.cern.ch/viewvc/trunk/EVE … ot=AliRoot
You can omit TEveManager::Terminate() to get a faster shutdown.

TEveBoxSet inherits from TEveDigitSet which holds a pointer to TEveRGBAPalette – this class holds limits and provides signal-color mapping. So, you can manually create the palette and assign it to the box-set – see tutorials tutorials/eve/boxset.C and quadset.C.

To add more histograms, have a look at tutorials/eve/histobrowser.C

If you want to add extra buttons to object-GUI, the only way is to sub-class from TEveBoxSet and also implement the GED editor class for you new class, e.g. if you create:
class TEveMyBoxSet : public TEveBoxSet …
you should also implement
class TEveMyBoxSetEditor …
and put your widgets there. Have a look at various classes ending with Editor under gui/ged/ and graf3d/eve/.

It would help if you have some experience with ROOT GUI before trying that … but it is really not too complicated if all you need is a couple of buttons.

Thinking about this … it would actually make sense to be able to attach some GUI components to EVE objects.

Cheers,
Matevz