diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx index 66dac58bcb6e8999d061fb4f5231a20846dbe715..693da7bdc02d7a04fde7845e9f5d50a87ed71870 100755 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx @@ -488,6 +488,14 @@ StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { delete (char*)tokenStr; tokenStr = nullptr; return(StatusCode::FAILURE); } + // Remove any old AttributeList + const DataHandle<AthenaAttributeList> oldAttrList; + if (eventStore()->retrieve(oldAttrList, m_attrListKey.value()).isSuccess()) { + if (!eventStore()->removeDataAndProxy(oldAttrList.cptr()).isSuccess()) { + ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate."); + return(StatusCode::FAILURE); + } + } AthenaAttributeList* athAttrList = new AthenaAttributeList(); if (!eventStore()->record(athAttrList, m_attrListKey.value()).isSuccess()) { ATH_MSG_ERROR("Cannot record AttributeList to StoreGate."); @@ -645,13 +653,6 @@ StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { } break; } - const DataHandle<AthenaAttributeList> oldAttrList; - if (eventStore()->retrieve(oldAttrList, m_attrListKey.value()).isSuccess()) { - if (!eventStore()->removeDataAndProxy(oldAttrList.cptr()).isSuccess()) { - ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate."); - return(StatusCode::FAILURE); - } - } } else { if (!m_skipEventSequence.empty() && m_evtCount == m_skipEventSequence.front()) { m_skipEventSequence.erase(m_skipEventSequence.begin()); @@ -999,6 +1000,14 @@ PoolCollectionConverter* EventSelectorAthenaPool::getCollectionCnv(bool throwInc } //__________________________________________________________________________ StatusCode EventSelectorAthenaPool::recordAttributeList() const { + // Remove any old AttributeList + const DataHandle<AthenaAttributeList> oldAttrList; + if (eventStore()->retrieve(oldAttrList, m_attrListKey.value()).isSuccess()) { + if (!eventStore()->removeDataAndProxy(oldAttrList.cptr()).isSuccess()) { + ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate."); + return(StatusCode::FAILURE); + } + } // Get access to AttributeList ATH_MSG_DEBUG("Get AttributeList from the collection"); // MN: accessing only attribute list, ignoring token list