TGFileBrowser::DoubleClicked Crash

I am trying to embed a TGFileBrowser inside a TGCompositeFrame. This is all within a TEveManager that also contains a Canvas. The goal is to be able to doubleclick a histogram in the file browser and have it get drawn to the canvas. Currently, histograms can be dragged-and-dropped to the canvas, but double-clicking will cause a crash:

[code] *** Break *** segmentation violation

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

#0 0x00007f7abaecd9be in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f7abae52f4e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007f7abbb7fb17 in TUnixSystem::StackTrace() () from /home/elem/root/lib/libCore.so
#3 0x00007f7abbb82473 in TUnixSystem::DispatchSignals(ESignals) () from /home/elem/root/lib/libCore.so
#4
#5 0x00007f7ab5538135 in TGFileBrowser::DoubleClicked(TGListTreeItem*, int) () from /home/elem/root/lib/libGui.so
#6 0x00007f7ab58e1856 in G__G__Gui3_421_0_23(G__value*, char const*, G__param*, int) () from /home/elem/root/lib/libGui.so
#7 0x00007f7aba2f07cf in Cint::G__CallFunc::Execute(void*) () from /home/elem/root/lib/libCint.so
#8 0x00007f7abbb3faec in TCint::CallFunc_Exec(void*, void*) const () from /home/elem/root/lib/libCore.so
#9 0x00007f7abbadfef5 in TQConnection::ExecuteMethod(long*, int) () from /home/elem/root/lib/libCore.so
#10 0x00007f7abbae35e7 in TQObject::Emit(char const*, long*) () from /home/elem/root/lib/libCore.so
#11 0x00007f7ab5574b93 in TGListTree::DoubleClicked(TGListTreeItem*, int) () from /home/elem/root/lib/libGui.so
#12 0x00007f7ab5578d18 in TGListTree::HandleDoubleClick(Event_t*) () from /home/elem/root/lib/libGui.so
#13 0x00007f7ab554b126 in TGFrame::HandleEvent(Event_t*) () from /home/elem/root/lib/libGui.so
#14 0x00007f7ab551d1eb in TGClient::HandleEvent(Event_t*) () from /home/elem/root/lib/libGui.so
#15 0x00007f7ab551d345 in TGClient::ProcessOneEvent() () from /home/elem/root/lib/libGui.so
#16 0x00007f7ab551d3ad in TGClient::HandleInput() () from /home/elem/root/lib/libGui.so
#17 0x00007f7abbb82b58 in TUnixSystem::DispatchOneEvent(bool) () from /home/elem/root/lib/libCore.so
#18 0x00007f7abbb01176 in TSystem::InnerLoop() () from /home/elem/root/lib/libCore.so
#19 0x00007f7abbb02e54 in TSystem::Run() () from /home/elem/root/lib/libCore.so
#20 0x00007f7abbaa4f0f in TApplication::Run(bool) () from /home/elem/root/lib/libCore.so
#21 0x00007f7abb6f583c in TRint::Run(bool) () from /home/elem/root/lib/libRint.so
#22 0x0000000000400f5c 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.

#5 0x00007f7ab5538135 in TGFileBrowser::DoubleClicked(TGListTreeItem*, int) () from /home/elem/root/lib/libGui.so

[/code]

I have constucted a small self-contained script that reproduces the problem.

[code]{
TEveManager::Create();
gEve->GetBrowser()->StartEmbedding(TRootBrowser::kRight);
TCanvas* canvas = new TCanvas();
gEve->GetBrowser()->StopEmbedding(“Canvas”);

TEveWindowSlot* slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabLeft());
TEveWindowFrame* frame = slot->MakeFrame();
frame->SetElementName(“Frame”);
TGCompositeFrame* cf = frame->GetGUICompositeFrame();
TBrowser* b;
TGFileBrowser* filebrowser = new TGFileBrowser(cf,b,240,400);
TH1D* h1=new TH1D(“h1”,“h1”,10,0,10);
h1->Fill(2);
filebrowser->Add(h1);
cf->AddFrame(filebrowser, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

gEve->GetBrowser()->GetTabLeft()->SetTab(2);
}[/code]

Interestingly, making the TGFileBrowser into it’s own tab gets rid of this problem (see code below). But I prefer to implement it in a TGCompositeFrame so I have the ability to resize it and include more widgets in the same tab.

[code]{
TEveManager::Create();

gEve->GetBrowser()->StartEmbedding(TRootBrowser::kRight);
TCanvas* canvas = new TCanvas();
gEve->GetBrowser()->StopEmbedding(“Canvas”);

gEve->GetBrowser()->StartEmbedding(0);
TGFileBrowser* browser = gEve->GetBrowser()->MakeFileBrowser();
gEve->GetBrowser()->StopEmbedding(“Tab”);

TH1D* h1=new TH1D(“h1”,“h1”,10,0,10);
h1->Fill(2);
browser->Add(h1);

gEve->GetBrowser()->GetTabLeft()->SetTab(2);
}
[/code]

Hi Chris,

There is indeed a protection missing in TGFileBrowser (I will commit a fix soon), but you should initialize the pointer to TBrowser to 0 anyway (or pass a pointer to an existing TBrowser), otherwise the behavior will be unpredictable and it will continue to crash…

Cheers, Bertrand.

Thanks for the reply Bertrand. I will use my workaround until the fix has been implemented.

Chris

You’re very welcome. And FYI, the protection has been committed in the master and in the v5-34-00-patches branch.

Cheers, Bertrand.