Skip to content

Commit cf312c2

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 1156296 commit cf312c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fairroot/geobase/FairGeoSet.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
@@ -55,6 +55,12 @@ FairGeoSet::FairGeoSet()
5555
FairGeoSet::~FairGeoSet()
5656
{
5757
// Destructor
58+
if (volumes && !volumes->IsOwner()) {
59+
// destructing a TList that doesn't own its contents
60+
// still touches the objects inside, even if they're
61+
// already destroeyed
62+
volumes->Clear("nodelete");
63+
}
5864
delete volumes;
5965
volumes = 0;
6066
delete modules;

0 commit comments

Comments
 (0)