From 07575bff54a479da42f9164d7dcd6c2b2682bff3 Mon Sep 17 00:00:00 2001 From: David Blyth <dblyth@anl.gov> Date: Wed, 2 May 2018 18:25:15 -0500 Subject: [PATCH] DDG4: Geant4Handle: fixed unhandled reference to shared actions This addresses issue #376. Previously, the initial m_refCount=1 was not being accounted for Also, this commit removes unnecessary readoption of the Geant4Actions --- DDG4/src/Geant4Handle.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/DDG4/src/Geant4Handle.cpp b/DDG4/src/Geant4Handle.cpp index 63aea5366..4e8cf1c54 100644 --- a/DDG4/src/Geant4Handle.cpp +++ b/DDG4/src/Geant4Handle.cpp @@ -116,11 +116,14 @@ namespace dd4hep { _ST* object = (_ST*)_create_object<TYPE>(kernel,s_type); CONT& container = (k.*pmf)(); TYPE* value = 0; - // Need to protect the global action sequence! - G4AutoLock protection_lock(&creation_mutex); { + { // Need to protect the global action sequence! + G4AutoLock protection_lock(&creation_mutex); value = container.get(typ.second); - if ( !value ) value = _create_object<TYPE>(k,typ); - container.adopt(value); + if ( !value ) { + value = _create_object<TYPE>(k,typ); + container.adopt(value); + value->release(); + } } object->use(value); value->info("+++ Created shared object for %s of type %s.", -- GitLab