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 Apr 22, 2024
1 parent 1156296 commit cf312c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fairroot/geobase/FairGeoSet.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
Expand Down Expand Up @@ -55,6 +55,12 @@ FairGeoSet::FairGeoSet()
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 cf312c2

Please sign in to comment.