Avoid double delete in THistSvc::finalize
The logic that allows regHist to take multiple histograms with the same name leads to a double delete in https://gitlab.cern.ch/gaudi/Gaudi/-/blob/master/GaudiSvc/src/THistSvc/THistSvc.cpp#L328 :
for ( auto& obj : m_tobjs ) {
// TObject*'s are already dealt with through root file i/o
delete obj.second.first; // delete vhid*
}
m_tobjs.clear();
because multiple elements of the map m_tobjs
share the same obj.second.first
, which is a std::vector<THistID>*
. This fix will only delete the pointer for the "first" occurrence.
Edited by Peter Onyisi