Skip to content

Commit

Permalink
fix: Properly clean up TList in FairGeoSet
Browse files Browse the repository at this point in the history
FairGeoSet has non-owning references inside a TList to
FairGeoNodes.  When the dtor of FairGeoSet is called, those
FairGeoNodes might already have been destroyed.

Calling `Clear` with `"nodelete"` will just remove all the
references without touching them.
  • Loading branch information
ChristianTackeGSI committed Jun 3, 2024
1 parent 31b4b7d commit 332e015
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fairroot/geobase/FairGeoSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ using std::ios;
FairGeoSet::~FairGeoSet()
{
// Destructor
if (volumes && !volumes->IsOwner()) {
// destructing a TList that doesn't own its contents
// still touches the objects inside, even if they're
// already destroeyed
volumes->Clear("nodelete");
}
delete volumes;
volumes = 0;
delete modules;
Expand Down

0 comments on commit 332e015

Please sign in to comment.