Trouble with TTreeViewer and Threads

Hi Rooters

I have trouble using the TTreeViewer in a standalone program

#include <iostream>
#include "TApplication.h"
#include "TROOT.h"
#include "TTreeViewer.h"

int main(int argc, char **argv) {
    TApplication theApp("App",&argc,argv);
    if (gROOT->IsBatch()) {
	std::cerr << argv[0] << ": cannot run in batch mode" << std::endl;
	return 1;
    }
    TTreeViewer* v = new TTreeViewer();
    theApp.Run();
    
    return 0;
}

When I compile and rune this code and try to open a root tree (under the “File” menu), it crashes . Here is a sinipet of the error message

However, the behavior is different in an interactive Cint session.

Compiled on 26 April 2007 for linuxx8664gcc with thread support.

CINT/ROOT C/C++ Interpreter version 5.16.19, March 16, 2007
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] TTreeViewer v;
Note: File "/export/home/guillo/ROOT/root_5.15_thread/lib/libGui.so" already loaded
root [1] .q

Here, I can open my root file containg a TTree object.
Now, if I type “.q” while the TTreeViewer windows is still on screen, everything is fine, root exits without any problem. If, on another hand I close the TTreeViewer window before quiting root, I have an error message similar to the one I have in the previous compiled code.

I am working on a Linux box, Mandriva 2006 64 bits. Kernel is 2.6.12-12 SMP, processor Xeon 5060 dual-core, gcc 4.0.1.
Root version is 5.15/06 (but I have the same problem with 5.15/04).

Thanks for your help

Hi Matthieu,

Normally I invoke TTreeViewer via the ROOT browser or create it from the root prompt. I will investigate how it will run in a way you do it on my linux machine at CERN next week (should say: not the same environment as yours) and will let you know.

Cheers, Ilka

Just a message to say that TTreeViewer does not look designed for a use in a standalone application (at least I have not found a way for that). We are planning to review this user interface in the near future.

Cheers, Ilka