Skip to content
Snippets Groups Projects
Commit 0de70f73 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'leak.SGTools-20201221' into 'master'

SGTools: Fix dummy proxy leak.

See merge request atlas/athena!39348
parents 607d84eb 3f031393
No related branches found
No related tags found
No related merge requests found
/* /*
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" #include "SGTools/DataStore.h"
...@@ -208,12 +208,17 @@ DataStore::removeProxy(DataProxy* proxy, bool forceRemove, bool hard) ...@@ -208,12 +208,17 @@ DataStore::removeProxy(DataProxy* proxy, bool forceRemove, bool hard)
int index = it->second.first; int index = it->second.first;
sc = StatusCode::SUCCESS; sc = StatusCode::SUCCESS;
// Remove primary entry.
m_keyMap.erase (it); m_keyMap.erase (it);
if (storeIter != m_storeMap.end()) { if (storeIter != m_storeMap.end()) {
if (1 == storeIter->second.erase(name)) { if (1 == storeIter->second.erase(name)) {
proxy->release(); proxy->release();
} }
} }
else {
// A dummy proxy.
proxy->release();
}
// Remove all symlinks too. // Remove all symlinks too.
for (CLID symclid : clids) for (CLID symclid : clids)
......
/* /*
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 * @file DataStore_test.cxx
* @author scott snyder <snyder@bnl.gov> * @author scott snyder <snyder@bnl.gov>
...@@ -512,6 +510,24 @@ void test_dummy ATLAS_NOT_THREAD_SAFE () ...@@ -512,6 +510,24 @@ void test_dummy ATLAS_NOT_THREAD_SAFE ()
assert (dp2->clID() == 456); assert (dp2->clID() == 456);
assert (dp2->name() == "dp2"); assert (dp2->name() == "dp2");
assert (dp2->refCount() == 1); 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);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment