From c5dbc384ae0fb0df756d5b3bac38dbfb8a65d377 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier Date: Thu, 25 Aug 2022 17:51:05 +0200 Subject: [PATCH] LArG4Code: do not delete ILArCalculatorSvc LArG4SimpleSD and LArG4CalibSD are deleting the `ILArCalculatorSvc` on their destruction claiming they are "owning" it. That is certainly wrong as services are not owned by an individual component. Likely didn't cause problems so far because the G4 RunManager who ultimately triggers this destructor is not being cleaned up properly either. --- LArCalorimeter/LArG4/LArG4Code/src/LArG4CalibSD.cc | 2 -- LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc | 2 -- 2 files changed, 4 deletions(-) diff --git a/LArCalorimeter/LArG4/LArG4Code/src/LArG4CalibSD.cc b/LArCalorimeter/LArG4/LArG4Code/src/LArG4CalibSD.cc index 6be3e764993..654ce375dcb 100644 --- a/LArCalorimeter/LArG4/LArG4Code/src/LArG4CalibSD.cc +++ b/LArCalorimeter/LArG4/LArG4Code/src/LArG4CalibSD.cc @@ -31,8 +31,6 @@ LArG4CalibSD::LArG4CalibSD(G4String a_name, ILArCalibCalculatorSvc* calc, bool d LArG4CalibSD::~LArG4CalibSD() { - // I owned my own calculator - delete m_calculator; if(verboseLevel>5 && m_numberInvalidHits>0) { G4cout << "Destructor: Sensitive Detector <" << SensitiveDetectorName << "> had " << m_numberInvalidHits << " G4Step energy deposits outside the region determined by its Calculator." << G4endl; diff --git a/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc b/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc index ce1b1fc207a..0ef2d1d2d88 100644 --- a/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc +++ b/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc @@ -69,8 +69,6 @@ LArG4SimpleSD::LArG4SimpleSD(G4String a_name, StoreGateSvc* detStore) LArG4SimpleSD::~LArG4SimpleSD() { - // I owned my own calculator - delete m_calculator; if(verboseLevel>5 && m_numberInvalidHits>0) { G4cout << "Destructor: Sensitive Detector <" << SensitiveDetectorName << "> had " << m_numberInvalidHits << " G4Step energy deposits outside the region determined by its Calculator." << G4endl; -- GitLab