diff --git a/Control/SGTools/src/DataStore.cxx b/Control/SGTools/src/DataStore.cxx index d7e596184fb368da9ba7d40bc25b212a6e792d9d..125bf7a485f4cac2c772ecb60188e7fdf01e268f 100755 --- a/Control/SGTools/src/DataStore.cxx +++ b/Control/SGTools/src/DataStore.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SGTools/DataStore.h" @@ -208,12 +208,17 @@ DataStore::removeProxy(DataProxy* proxy, bool forceRemove, bool hard) int index = it->second.first; sc = StatusCode::SUCCESS; + // Remove primary entry. m_keyMap.erase (it); if (storeIter != m_storeMap.end()) { if (1 == storeIter->second.erase(name)) { proxy->release(); } } + else { + // A dummy proxy. + proxy->release(); + } // Remove all symlinks too. for (CLID symclid : clids) diff --git a/Control/SGTools/test/DataStore_test.cxx b/Control/SGTools/test/DataStore_test.cxx index ce081b63da65389d5c81a2cd9bd4c8851113ffe9..2223c6dc42755a78c549fafc33090e7b7fd30447 100644 --- a/Control/SGTools/test/DataStore_test.cxx +++ b/Control/SGTools/test/DataStore_test.cxx @@ -1,8 +1,6 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id$ /** * @file DataStore_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -512,6 +510,24 @@ void test_dummy ATLAS_NOT_THREAD_SAFE () assert (dp2->clID() == 456); assert (dp2->name() == "dp2"); assert (dp2->refCount() == 1); + + SG::StringPool::sgkey_t sgkey3 = pool.stringToKey ("dp3", 456); + SG::DataProxy* dp3 = make_proxy (0, "", sgkey3); + assert (store.addToStore (0, dp3).isSuccess()); + assert (dp3->refCount() == 1); + assert (store.proxy_exact (sgkey3) == dp3); + + dp1->addRef(); + dp2->addRef(); + dp3->addRef(); + assert (dp1->refCount() == 2); + assert (dp2->refCount() == 2); + assert (dp3->refCount() == 2); + + store.clearStore (true, false, nullptr); + assert (dp1->refCount() == 1); + assert (dp2->refCount() == 1); + assert (dp3->refCount() == 1); }