there seems to be a problem with TList::Clear in case that the stored object
is a file or directory pointer. After calling Clear, the object is not only
removed from the list but is itself erased? This is not the case with
TOrdCollection. See example:
{
gROOT.Reset();
printf("test TOrdColl..\n");
fr = new TFile("test.root","recreate");
TList *list = new TOrdCollection();
list.Add(fr);
fr.ls();
list.Clear();
fr.ls();
delete list;
delete fr;
gROOT.Reset();
printf("\n");
printf("test TList..\n");
fr = new TFile("test.root","recreate");
TList *list = new TList();
list.Add(fr);
fr.ls();
list.Clear();
fr.ls();
}
and the output
Enclose multiple statements between { }.
root [0] .x test.C
test TOrdColl..
TFile** test.root
TFile* test.root
TFile** test.root
TFile* test.root
test TList..
TFile** test.root
TFile* test.root
*** Break *** segmentation violation
thanks..
Hajo!