Skip to content

Commit e97dc36

Browse files
committed
TFileMerger _actually_ delete directory only if we induced its creation/loading
This is the actual heart of 30fd4c7 which incorrect did the reverse of its intent. This fixes #8226
1 parent e4823a1 commit e97dc36

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

io/io/src/TFileMerger.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,11 @@ Bool_t TFileMerger::MergeOne(TDirectory *target, TList *sourcelist, Int_t type,
557557
auto getDirectory = [&dirtodelete](TDirectory *parent, const char *name, const TString &pathname)
558558
{
559559
TDirectory *result = dynamic_cast<TDirectory*>(parent->GetList()->FindObject(name));
560-
if (!result)
560+
if (!result) {
561561
result = parent->GetDirectory(pathname);
562-
else
563-
dirtodelete.Add(result);
562+
if (result && result != parent)
563+
dirtodelete.Add(result);
564+
}
564565

565566
return result;
566567
};

0 commit comments

Comments
 (0)