Hello,
The program (simplified version in the attachment) is crashed after create/delete ROOT browser via " Start Browser/Stop Browser" button when mouse is moved onto canvas field. What is wrong/absent in the code?
Thanks and regards,
Vladimir.
brtest.C (2.26 KB)
Hi,
It’s not obvious to me either. We are waiting for Bertrand to come back - he should be able to help you on Friday or so!
Cheers, Axel.
It does not crash for me if I always close the TBrowser with the Stop button.
It crashes if I close the browser window directly and then hit the “Stop” button. Because then, your function tries to access fBrowser, which has been already deleted by GUI.
L.68 delete fBrowser;//fBrowser does not exist anymore, closed by GUI "X" button
Note: I compile with v5.34 (Windows) and root -l brtest.C+
Hi,
Here is a solution:
//------------------------------------------------------------------------------
TestMainFrame::BrowserClosed()
{
fBrowser = 0;
fstBrowser->SetText("Start Browser");
}
//-----------------------------------------------------------------------------
void TestMainFrame::StartBrowser()
{
if(!fBrowser) {
fBrowser = new TBrowser("BRO","Histogram browser");
fstBrowser->SetText("Stop Browser");
fBrowser->GetBrowserImp()->GetMainFrame()->Connect("CloseWindow()",
"TestMainFrame", this, "BrowserClosed()");
} else {
delete fBrowser;
fBrowser = 0;
fstBrowser->SetText("Start Browser");
}
}
Cheers, Bertrand.