From 3622a794f4161b969ed2f55d7c998a08d238424e Mon Sep 17 00:00:00 2001 From: sss <sss@karma> Date: Fri, 10 Jan 2025 14:23:50 -0500 Subject: [PATCH] Fix potential use of dangling temporary. In ``` const TGeoHMatrix& m = par.nominal().worldTransformation(); ``` nominal() returns a temporary Alignment object by value, and worldTransformation() returns a reference within that Alignment object. So we shoud make a copy. --- examples/LHeD/src/Lhe_PolyhedraEndcapCalorimeter2_surfaces.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/LHeD/src/Lhe_PolyhedraEndcapCalorimeter2_surfaces.cpp b/examples/LHeD/src/Lhe_PolyhedraEndcapCalorimeter2_surfaces.cpp index d6ea22b67..76a80d816 100644 --- a/examples/LHeD/src/Lhe_PolyhedraEndcapCalorimeter2_surfaces.cpp +++ b/examples/LHeD/src/Lhe_PolyhedraEndcapCalorimeter2_surfaces.cpp @@ -31,7 +31,7 @@ void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVo } else if ( !handleUsingCache(component,comp_vol) ) { dd4hep::DetElement par = component.parent(); - const TGeoHMatrix& m = par.nominal().worldTransformation(); + const TGeoHMatrix m = par.nominal().worldTransformation(); double dz = m.GetTranslation()[2]; const double* trans = placementTranslation(component); double half_mod_thickness = (mod_shape->GetZ(1)-mod_shape->GetZ(0))/2.0; -- GitLab