diff --git a/tree/ntuple/v7/inc/ROOT/RField.hxx b/tree/ntuple/v7/inc/ROOT/RField.hxx index 6bb7f466177dc..63762a3c05dd5 100644 --- a/tree/ntuple/v7/inc/ROOT/RField.hxx +++ b/tree/ntuple/v7/inc/ROOT/RField.hxx @@ -183,10 +183,6 @@ public: friend class RFieldBase; private: - /// Empty shared pointer, used as the basis for an aliasing shared pointer constructor in BindRawPtr. - /// Note that as a result of BindRawPtr, fObjPtr will be non-empty but have use count zero. - static std::shared_ptr fgRawPtrCtrlBlock; - RFieldBase *fField = nullptr; ///< The field that created the RValue std::shared_ptr fObjPtr; ///< Set by Bind() or by RFieldBase::CreateValue(), SplitValue() or BindValue() @@ -203,7 +199,7 @@ public: void Read(NTupleSize_t globalIndex) { fField->Read(globalIndex, fObjPtr.get()); } void Read(RClusterIndex clusterIndex) { fField->Read(clusterIndex, fObjPtr.get()); } void Bind(std::shared_ptr objPtr) { fObjPtr = objPtr; } - void BindRawPtr(void *rawPtr) { fObjPtr = std::shared_ptr(fgRawPtrCtrlBlock, rawPtr); } + void BindRawPtr(void *rawPtr); /// Replace the current object pointer by a pointer to a new object constructed by the field void EmplaceNew() { fObjPtr = fField->CreateValue().GetPtr(); } diff --git a/tree/ntuple/v7/src/RField.cxx b/tree/ntuple/v7/src/RField.cxx index 27ba83b8e1e53..716a5859f28ad 100644 --- a/tree/ntuple/v7/src/RField.cxx +++ b/tree/ntuple/v7/src/RField.cxx @@ -338,7 +338,13 @@ ROOT::Experimental::RFieldBase::RColumnRepresentations::RColumnRepresentations( //------------------------------------------------------------------------------ -std::shared_ptr ROOT::Experimental::RFieldBase::RValue::fgRawPtrCtrlBlock; +void ROOT::Experimental::RFieldBase::RValue::BindRawPtr(void *rawPtr) +{ + /// Empty shared pointer, used as the basis for the aliasing shared pointer constructor around rawPtr. + /// Note that as a result of BindRawPtr, fObjPtr will be non-empty but have use count zero. + static std::shared_ptr fgRawPtrCtrlBlock; + fObjPtr = std::shared_ptr(fgRawPtrCtrlBlock, rawPtr); +} //------------------------------------------------------------------------------