diff --git a/tree/treeplayer/inc/ROOT/TTreeProcessorMT.hxx b/tree/treeplayer/inc/ROOT/TTreeProcessorMT.hxx index 595532547cf49afc0fb59831ab21349b9317b31d..934700f2dad523adfa284aceca19bed1e2735c63 100644 --- a/tree/treeplayer/inc/ROOT/TTreeProcessorMT.hxx +++ b/tree/treeplayer/inc/ROOT/TTreeProcessorMT.hxx @@ -274,6 +274,7 @@ namespace ROOT { reader->SetEntriesRange(start, end); } + // we need to return the entry list too, as it needs to be in scope as long as the reader is return std::make_pair(std::move(reader), std::move(elist)); } @@ -293,11 +294,11 @@ namespace ROOT { ////////////////////////////////////////////////////////////////////////// /// Push a new loaded entry to the stack. - void PushLoadedEntry(Long64_t entry) { fLoadedEntries.push_back(entry); } + void PushTaskFirstEntry(Long64_t entry) { fLoadedEntries.push_back(entry); } ////////////////////////////////////////////////////////////////////////// /// Restore the tree of the previous loaded entry, if any. - void RestoreLoadedEntry() + void PopTaskFirstEntry() { fLoadedEntries.pop_back(); if (fLoadedEntries.size() > 0) { diff --git a/tree/treeplayer/src/TTreeProcessorMT.cxx b/tree/treeplayer/src/TTreeProcessorMT.cxx index 9bcb0d9d8260705761cf467f69553e2cf9b04ec2..5d3cdf866149e73e19d2d4701ec61384c6ee9372 100644 --- a/tree/treeplayer/src/TTreeProcessorMT.cxx +++ b/tree/treeplayer/src/TTreeProcessorMT.cxx @@ -111,14 +111,14 @@ void TTreeProcessorMT::Process(std::function<void(TTreeReader &)> func) auto mapFunction = [this, &func](const ROOT::Internal::TreeViewCluster &c) { // This task will operate with the tree that contains startEntry - treeView->PushLoadedEntry(c.startEntry); + treeView->PushTaskFirstEntry(c.startEntry); auto readerAndEntryList = treeView->GetTreeReader(c.startEntry, c.endEntry); auto &reader = std::get<0>(readerAndEntryList); func(*reader); // In case of task interleaving, we need to load here the tree of the parent task - treeView->RestoreLoadedEntry(); + treeView->PopTaskFirstEntry(); }; // Assume number of threads has been initialized via ROOT::EnableImplicitMT