Break segmentation fault after quitting the canvas

Hi there,
I have compiled ROOT version 6.04.16 on ubuntu 16, I follow this tips(http://devnull.ofehr.ch/2016/05/05/installing-root-6-0602-on-ubuntu-15-1016-04/#more-113). The only difference from the article is that I build it in /home/ROOT/build and have the extracted source code in /home/ROOT/root.

The first problem I occurred, is that when I compile a program with ROOT library the terminal protest saying :

error while loading shared libraries: libCore.so: cannot open 
> shared object file: No such file or directory

I don’t know how but the problem is fixed the next time I have tried.
And now the real problem. The program compile and the ROOT GUI works but when I click to quit the canvas, the terminal says:

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fb948b6564a in __GI___waitpid (pid=6426, stat_loc=stat_loc
entry=0x7fff9b89a1c0, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007fb948adefab in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007fb949c4e844 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x1c414f0) at /home/erika/ROOT/root/core/unix/src/TUnixSystem.cxx:2073
#3  TUnixSystem::StackTrace (this=0x1c414f0) at /home/erika/ROOT/root/core/unix/src/TUnixSystem.cxx:2301
#4  0x00007fb949c5092c in TUnixSystem::DispatchSignals (this=0x1c414f0, sig=kSigSegmentationViolation) at /home/erika/ROOT/root/core/unix/src/TUnixSystem.cxx:3539
#5  <signal handler called>
#6  0x00007fb93d121725 in ?? () from /usr/lib/x86_64-linux-gnu/libXft.so.2
#7  0x00007fb93d11d667 in ?? () from /usr/lib/x86_64-linux-gnu/libXft.so.2
#8  0x00007fb93e5ac642 in XCloseDisplay () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#9  0x00007fb93e8e5840 in TGX11::CloseDisplay (this=0x2c21c80) at /home/erika/ROOT/root/graf2d/x11/src/GX11Gui.cxx:863
#10 0x00007fb93d7a8e8a in TGClient::~TGClient (this=0x2c3e890, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TGClient.cxx:631
#11 0x00007fb93d7a8eb9 in TGClient::~TGClient (this=0x2c3e890, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TGClient.cxx:633
#12 0x00007fb93d75d31f in TRootApplication::~TRootApplication (this=0x2c3e7f0, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TRootApplication.cxx:60
#13 0x00007fb93d75d349 in TRootApplication::~TRootApplication (this=0x2c3e7f0, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TRootApplication.cxx:61
#14 0x00007fb949b81ce5 in TApplication::~TApplication (this=0x7fff9b89cc90, __in_chrg=<optimized out>) at /home/erika/ROOT/root/core/base/src/TApplication.cxx:244
#15 0x00000000004015a1 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.
===========================================================
#6  0x00007fb93d121725 in ?? () from /usr/lib/x86_64-linux-gnu/libXft.so.2
#7  0x00007fb93d11d667 in ?? () from /usr/lib/x86_64-linux-gnu/libXft.so.2
#8  0x00007fb93e5ac642 in XCloseDisplay () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#9  0x00007fb93e8e5840 in TGX11::CloseDisplay (this=0x2c21c80) at /home/erika/ROOT/root/graf2d/x11/src/GX11Gui.cxx:863
#10 0x00007fb93d7a8e8a in TGClient::~TGClient (this=0x2c3e890, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TGClient.cxx:631
#11 0x00007fb93d7a8eb9 in TGClient::~TGClient (this=0x2c3e890, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TGClient.cxx:633
#12 0x00007fb93d75d31f in TRootApplication::~TRootApplication (this=0x2c3e7f0, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TRootApplication.cxx:60
#13 0x00007fb93d75d349 in TRootApplication::~TRootApplication (this=0x2c3e7f0, __in_chrg=<optimized out>) at /home/erika/ROOT/root/gui/gui/src/TRootApplication.cxx:61
#14 0x00007fb949b81ce5 in TApplication::~TApplication (this=0x7fff9b89cc90, __in_chrg=<optimized out>) at /home/erika/ROOT/root/core/base/src/TApplication.cxx:244
#15 0x00000000004015a1 in main ()

The program is really simple. It is just to try that everything was compiled well. Anyway here the code:

#include <TApplication.h>
#include <TF1.h>

int main() { 
 
 TApplication up("up",0,NULL);

 TF1 *f = new TF1 ("f","sin(x)/x",-1,10);
 f -> Draw();
 
 up.Run(true);
 return 0;
}

Any ideas why it happens ??? And how can I fix it ???

Thanks everybody,

Erika

This is a long-standing problem in ROOT (and nobody cares). :-&

In ROOT 5 (e.g. 5.34/36), you can solve it by using a heap-based object:

// ...
TApplication *up = new TApplication("up", 0, 0);
// ...
up->Run(kTRUE);
// ...

Unfortunately, in ROOT 6 (I just tried 6.06/06) one still gets (when doing “canvas_main_menu” -> “File” -> “Quit ROOT”):

*** Error in `./up': double free or corruption (!prev): 0x0000000002413980 ***
Aborted (core dumped)

So, for the moment, with ROOT 6, you need to use “up->Run(kFALSE);” (so that your “TApplication” does NOT return into your “main” at all). :-({|=

New JIRA report: sft.its.cern.ch/jira/browse/ROOT-8307

okay I just add

TApplication *up = new TApplication ("up", 0, NULL);
up -> Run(kTRUE);

and I can quit ROOT without compile complains. But I don’t understand why. And I’m sorry for my ignorance, but why do I need to use kTRUE or kFALSE instead of true and false ???

Thanks
Erika

You can use “true” and “false”.