I have a root file with a TDirectoryFile ,and it contains many TCanvas. When I use TBrowser a to look the pictures, I can only look at most 10 pictures, then there will be a collapse . And I can’t look other pictures. What should I do ,now I can only reopen the root file and select other pictures. Could you please give me some advice?
I just tried with ROOT master on Windows and all I got is the following errors:
C:\Users\bellenot\Downloads>root -l outFile_FF.root
root [0]
Attaching file outFile_FF.root as _file0...
(TFile *) 0x1b8c4919850
root [1] TBrowser b
(TBrowser &) Name: Browser Title: ROOT Object Browser
root [2] Error in <TList::Clear>: A list is accessing an object (000001B8C553B040) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C5538BB0) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C553A410) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C5538FC0) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C55397E0) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C5536310) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C1A801F0) already deleted (list name = TList)
Error in <TList::Clear>: A list is accessing an object (000001B8C55352D0) already deleted (list name = TList)
auto f = new TFile("outFile_FF.root");
auto dir = f->GetDirectory("fracs1");
TCanvas *c;
c = (TCanvas *)dir->Get("fracs1_sig_smoothed_hist_from_KDE_et20eta0.00");
c->Draw();
When I quit ROOT I get:
Error in <TList::Clear>: A list is accessing an object (0x7fdfa5b23650) already deleted (list name = TList)
Most probably reason is histogram, which appears twice in the canvas - with different draw option.
And ROOT crashed when trying to cleanup list of primitives in the pad.
I have workaround, but this is very general problem of TList class.
At least for TPad primitives I will provide PR which should avoid crash.
Finally this PR from @pcanal should solve problem with proper handling and closing of such canvases. It is cleanup problem of histograms read from ROOT file.
About showing such many number of canvas in web browser - it is limitation of 10 threads, which are created by default in web server. One can increase default number of threads providing
gEnv->SetValue("WebGui.HttpThreads", 30);
Or creating .rootrc file with the entry:
WebGui.HttpThreads: 30
I will add warning message when too much web widgets are created at once.
Here is example macro how to show so many canvases all together inside web-based TBrowser:
{
gEnv->SetValue("WebGui.HttpThreads", 30);
auto f = new TFile("/home/user/files/outFile_FF.root");
auto dir = f->GetDirectory("fracs1");
new TBrowser;
TIter iter(dir->GetListOfKeys());
int cnt = 0;
while (auto key = iter()) {
if (++cnt < 25) {
auto c = (TCanvas *) dir->Get(key->GetName());
c->Draw();
}
}
}
All these canvases will be showed inside RBrowser and not as independent windows.