TCanvas DrawBox crash in batch mode output

The following code produces a crash at the TImageDump::DrawBox() method,
when running in batch mode; this works fine in interactive mode. The referenced
canvas looks OK, but perhaps there is something subtle wrong with it?
Attached are the muon.root file, source file, and session crash log.

I have tried recent root versions, include v5_12_00e, v5_13_04, and
from the CVS head; all on linux SL3.0.5. Any ideas?

void daqmon()
{
TFile *file = new TFile(“muon.root”,“READ”);
TCanvas *canvas = NULL;
if ( file->IsOpen())
{
TKey *key = file->FindKeyAny(“multPerEventME11Chamber29;1”);
if ( key != NULL )
{
canvas = (TCanvas *)key->ReadObj();
if ( canvas != NULL )
{
canvas->Draw();
}
}
file->Close();
}
if ( canvas != NULL ) { canvas->Print(“muon.png”);}
}

int main(int argc, char **arg)
{
gROOT->SetBatch(kTRUE);
TApplication * app = new TApplication(“daqmon”, &argc, arg);
daqmon();
return(0);
}
daqmon.log.txt (1.33 KB)
muon.root (1.28 MB)
daqmon.cc.txt (676 Bytes)

Hi William,
the problem is with histogram fill color which is 4000 (why?).
In batch mode it crashes because such color doesn’t exist.
I will add sanity checks to TImageDump to avoid such cases.
However, even in GUI mode I see the messages:

indicating that fill color is wrong.

Thanks for reporting this.

Regards. Valeriy

Hi,
the fix with color is in CVS, but your macro is still not running,
another bug was found. Must be fixed asap.

More thanks. Regards. Valeriy

everything fixed in CVS. thanks

Thanks for this fix, and the other one earlier! The batch mode
graphics are very useful…

thanks to you, still small improvment is coming
do not forget animated GIFs in batch mode :slight_smile: