Crash when drawing a TH2F, but not if colz is specified

Dear ROOT team,

In a previous thread, a couple of years ago, I reported a problem drawing a certain histogram although it worked if I specified the option “colz”. The bug was then fixed by the ROOT team. See [url]Crash when drawing a TH2F, but not if colz is specified

Unfortunately, I have come accross the same bug once more. To reproduce do :

  1. connect to lxplus
  2. get the test.root file attached to this post
  3. start ROOT
  4. Type in :

TFile f("test.root") TIter nextkey(f.GetListOfKeys()); TKey *key = (TKey*)nextkey() TObject *obj = key->ReadObj(); TH2F* h2 = dynamic_cast<TH2F*>(obj) h2->Draw("colz"); // --> fine h2->Draw(); // --> crash

I paste the stack trace at the end of the post.

Could you have a look at it ?
Thank you very much.


PS: once, and only once, the code worked seamlessly on lxplus. All my other attempts failed. Maybe a different machine ?

The crash reads :

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

#0 0x00002b90c34f61a5 in waitpid () from /lib64/
#1 0x00002b90c34984a1 in do_system () from /lib64/
#2 0x00002b90c113aea2 in TUnixSystem::StackTrace() ()
from /afs/
#3 0x00002b90c1137b6a in TUnixSystem::DispatchSignals(ESignals) ()
from /afs/
#5 0x0000000000000000 in ?? ()
#6 0x00002b90c8fb2f5f in THistPainter::PaintTable(char const*) ()
from /afs/
#7 0x00002b90c8fbd629 in THistPainter::Paint(char const*) ()
from /afs/
#8 0x00002b90c66b563f in TPad::PaintModified() ()
from /afs/
#9 0x00002b90c6699365 in TCanvas::Update() ()
from /afs/
#10 0x00002b90c10f3bef in TCint::UpdateAllCanvases() ()
from /afs/
#11 0x00002b90c10f5246 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) ()
from /afs/
#12 0x00002b90c10f5133 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) ()
from /afs/
#13 0x00002b90c26669cf in TRint::HandleTermInput() ()
from /afs/
#14 0x00002b90c2665217 in TTermInputHandler::Notify() ()
from /afs/
#15 0x00002b90c2667a4d in TTermInputHandler::ReadNotify() ()
from /afs/
#16 0x00002b90c11377a3 in TUnixSystem::CheckDescriptors() ()
from /afs/
#17 0x00002b90c1137cde in TUnixSystem::DispatchOneEvent(bool) ()
from /afs/
#18 0x00002b90c10ae686 in TSystem::InnerLoop() ()
from /afs/
#19 0x00002b90c10b18e1 in TSystem::Run() ()
from /afs/
#20 0x00002b90c104e25f in TApplication::Run(bool) ()
from /afs/
#21 0x00002b90c26676df in TRint::Run(bool) ()
from /afs/
#22 0x000000000040100d in main ()

test.root (12.4 KB)

On Mac with the latest root I do not get a crash.
I’ll check on lxplus.

Oh sorry I get the crash too if I do the h2->Draw() only…

Your “test.root” contains …
KEY: TH2D DataVolume;1 Data Volume per Sector
TH2D is not TH2F.
However, even if I correct it, I also get the problem with ROOT 5.28, 5.30, 5.33 (Ubuntu 10.04.4 LTS i686 SMP, gcc 4.4.3) when I try:

root [0] TFile *f = new TFile("test.root", "READ"); root [1] TH2D *h; root [2] f->GetObject("DataVolume", h); root [3] if (h) h->Draw("colz"); root [4] if (h) h->Draw();

I get the crash only doing:

root [0] TFile f("test.root")
root [1] DataVolume->Draw(); 

O.K. This is version specific then.
With ROOT 5.30 and 5.33 I also get the crash from ‘DataVolume->Draw();’, but this is not the case for ROOT 5.28.
With ROOT 5.28, the if I first ‘DataVolume->Draw(“colz”);’ and then ‘DataVolume->Draw();’ it produces the crash, but if I reverse it (i.e. first ‘DataVolume->Draw();’ then ‘DataVolume->Draw(“colz”);’) I get no crash.


I forgot to say which version of ROOT I was using. Sorry about that. It is ROOT 5.30/06, available in afs : /afs/

Thank you for your quick reaction.

And yes, it was a TH2D, you are correct.


I think I found what was wrong and the way to fix it. But doing that exercise I found similar cases in THistPainter.cxx. I am now checking them more carefully. I will let you know when I will commit the fix.

This is now fixed in the SVN trunk.
Thanks for reporting.

Thank you very much for your very quick reaction and fix.

Best regards,