From 0b1d030e77adc06182ada59540f3b0bf6db76d28 Mon Sep 17 00:00:00 2001 From: "Joseph F. Boudreau" <boudreau@pitt.edu> Date: Wed, 17 Jan 2024 15:03:01 +0100 Subject: [PATCH] Fix a problem with squashing of multiple GeoShapeShifts, in which the original shape disappears from memory in the second operation --- GeoModelCore/GeoModelKernel/src/GeoShapeShift.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeoModelCore/GeoModelKernel/src/GeoShapeShift.cxx b/GeoModelCore/GeoModelKernel/src/GeoShapeShift.cxx index c1b96725e..8977f9f5a 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoShapeShift.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoShapeShift.cxx @@ -14,7 +14,7 @@ GeoShapeShift::GeoShapeShift (const GeoShape* A, const GeoTrf::Transform3D &X): m_op{A}, m_shift{X} { /// Check whether the given shape also a shape shift. If so then we can simply /// take the operand of the sub shift and summarize the transformations of the two into one - if (getOp()->typeID() == typeID()) { + if (A->refCount() > 1 && getOp()->typeID() == typeID()) { const GeoShapeShift* subShift{static_cast<const GeoShapeShift*>(getOp())}; m_shift = subShift->getX() * getX(); m_op.reset(subShift->getOp()); -- GitLab