Skip to content

Commit

Permalink
Merge pull request #243 from veprbl/pr/heisenbug
Browse files Browse the repository at this point in the history
JFactoryPodioT: only delete shallow object in ClearData
  • Loading branch information
nathanwbrei authored Oct 2, 2023
2 parents ea9ebf5 + fad0866 commit ab7069e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libraries/JANA/Podio/JFactoryPodioT.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ void JFactoryPodioT<T>::ClearData() {
if (this->mStatus == JFactory::Status::Uninitialized) {
return;
}
for (auto p : this->mData) delete p;
for (auto p : this->mData) {
// Avoid potentially invalid call to ObjBase::release(). The frame and
// all the collections and all Obj may have been deallocated at this point.
p->unlink();
delete p;
}
this->mData.clear();
this->mCollection = nullptr; // Collection is owned by the Frame, so we ignore here
this->mFrame = nullptr; // Frame is owned by the JEvent, so we ignore here
Expand Down

0 comments on commit ab7069e

Please sign in to comment.