From 332e015889d414482ff35bb254a6881c05f1d6bc Mon Sep 17 00:00:00 2001 From: Christian Tacke <58549698+ChristianTackeGSI@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:14:47 +0200 Subject: [PATCH] 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. --- fairroot/geobase/FairGeoSet.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fairroot/geobase/FairGeoSet.cxx b/fairroot/geobase/FairGeoSet.cxx index d1045c4257..02296e0a7a 100644 --- a/fairroot/geobase/FairGeoSet.cxx +++ b/fairroot/geobase/FairGeoSet.cxx @@ -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;