Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[TDF] Allow proper re-usage of TDataFrameValues
Before this fix TDataFrame could attempt to re-use invalidated
TTreeReader{Value,Array}s in certain conditions.
  • Loading branch information
eguiraud committed Mar 29, 2017
commit 939fdebbb451240ae8988694b381f24f048d60cc
10 changes: 10 additions & 0 deletions tree/treeplayer/inc/ROOT/TDFNodes.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public:

void MakeProxy(TTreeReader &r, const std::string &bn)
{
Reset();
bool useReaderValue = std::is_same<ProxyParam_t, T>::value;
if (useReaderValue)
fReaderValue.reset(new TTreeReaderValue<T>(r, bn.c_str()));
Expand All @@ -163,6 +164,14 @@ public:

return std::array_view<ProxyParam_t>(fReaderArray->begin(), fReaderArray->end());
}

void Reset() {
fReaderValue = nullptr;
fReaderArray = nullptr;
fValuePtr = nullptr;
fTmpColumn = nullptr;
fSlot = 0;
}
};

template <typename T>
Expand Down Expand Up @@ -528,6 +537,7 @@ public:
template <typename T>
void ROOT::Internal::TDataFrameValue<T>::SetTmpColumn(unsigned int slot, ROOT::Detail::TDataFrameBranchBase *tmpColumn)
{
Reset();
fTmpColumn = tmpColumn;
if (tmpColumn->GetTypeId() != typeid(T))
throw std::runtime_error(std::string("TDataFrameValue: type specified is ") + typeid(T).name() +
Expand Down