From f20fb955ed33463aad6c57361f16d661aeebc3a4 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <frank.winklmeier@cern.ch>
Date: Mon, 22 Nov 2021 10:55:41 +0100
Subject: [PATCH] ConfigurableService: copy private tools of services

Fix bug in `ConfigurableService` to make sure private tools are copied
when being added to the service.

Closes issue #208.
---
 GaudiKernel/python/GaudiKernel/Configurable.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/GaudiKernel/python/GaudiKernel/Configurable.py b/GaudiKernel/python/GaudiKernel/Configurable.py
index 022978da9c..2ce7dfddc6 100644
--- a/GaudiKernel/python/GaudiKernel/Configurable.py
+++ b/GaudiKernel/python/GaudiKernel/Configurable.py
@@ -1,5 +1,5 @@
 #####################################################################################
-# (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations #
+# (c) Copyright 1998-2021 CERN for the benefit of the LHCb and ATLAS collaborations #
 #                                                                                   #
 # This software is distributed under the terms of the Apache version 2 licence,     #
 # copied verbatim in the file "LICENSE".                                            #
@@ -1161,7 +1161,11 @@ class ConfigurableService(Configurable):
         return self  # services are always shared
 
     def copyChild(self, child):
-        return child  # full sharing
+        # Copy private tools but all else is shared
+        if isinstance(child, ConfigurableAlgTool) and not child.isPublic():
+            return copy.deepcopy(child)
+        else:
+            return child
 
     def getHandle(self):
         return iService(self._name)
-- 
GitLab