Skip to content

TrkiPatFitterUtils, etc: Fix garbage collection.

MaterialAllocator had a garbage collection mechanism, where TrackStateOnSurface objects were not deleted immediately, but instead added to a list to be deleted at the end of a fit. This list was held in a mutable member variable and was thus problematic for MT. A previous change altered the code so that these objects are deleted immedately, rather than being saved until the end of the fit. Unfortunately, this does not work: the q221 test crashes due to the iPat code trying to dereference pointers to surfaces that were deleted as part of the garbage collection (this was in MaterialAllocator::spectrometerMaterial). Restore the previous delayed-deletion behavior, but rather than keep the list to be deleted in a member variable, allocate it automatically in the fit() methods and pass it explicitly to everyone who may need to add to it.

See also ATR-19775.

Merge request reports