Segmentation Violation in TDirectory

Hi!

I recently dicovered this and don’t think that this is considered to be expected behaviour…
Is there anything I’m doing wrong, or is this simply a bug?

root [0] TDirectory* dir = new TDirectory()
root [1] TH1F* hist = new TH1F("hist","hist",10,0,10)
root [2] gDirectory->Print()
TH1.Print Name  = hist, Entries= 0, Total sum= 0
root [3] hist->SetDirectory(dir)
root [4] dir->Print()
root [5] dir->ls()
root [6] dir->FindObject("hist")

 *** Break *** segmentation violation

I am using root version 5.34/10, but was able to reproduce the problem in 5.34/08 as well on various machines.
Is there any workaround?

Regards,
Carsten

Hi Carsten,

Use the proper TDirectory constructor. For example:

TDirectory* dir = new TDirectory("dir", "")Since the TDirectory default constructor does nothing…

Cheers, Bertrand.