Skip to content

Commit 332e015

Browse files
fix: Properly clean up TList in FairGeoSet
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.
1 parent 31b4b7d commit 332e015

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fairroot/geobase/FairGeoSet.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ using std::ios;
4141
FairGeoSet::~FairGeoSet()
4242
{
4343
// Destructor
44+
if (volumes && !volumes->IsOwner()) {
45+
// destructing a TList that doesn't own its contents
46+
// still touches the objects inside, even if they're
47+
// already destroeyed
48+
volumes->Clear("nodelete");
49+
}
4450
delete volumes;
4551
volumes = 0;
4652
delete modules;

0 commit comments

Comments
 (0)