aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-02-04 13:00:49 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2019-02-04 13:02:43 +0100
commitebc6542d982c5fb7ad965ce3b365800a44e0e635 (patch)
treedfdedc34c0282c46c564eff0aaa17b28eb31c155
parent424327e1a8f5ccc0ebd9265c50725d37093d5164 (diff)
parent712d35bc563ac7de0b7dfc3a35fc48dc6448fa6a (diff)
Merge #15322: wallet: Add missing cs_db lock
712d35bc563ac7de0b7dfc3a35fc48dc6448fa6a wallet: Add missing cs_db lock (João Barbosa) Pull request description: Without this lock `BerkeleyEnvironment::~BerkeleyEnvironment` and `GetWalletEnv` would race for `g_dbenvs`. This wasn't detected before because thread safety analysis does not check constructors and destructors. Reference: http://releases.llvm.org/5.0.2/tools/clang/docs/ThreadSafetyAnalysis.html#no-checking-inside-constructors-and-destructors Tree-SHA512: 350cb2b991ca699a6bca85f87c82c38f0814484c8ccb0d7d83cb3bff9afcf60dd32b2a9554a9e72eb5803bfad8b6970fe7da618b39be5889178b86faa1b74124
-rw-r--r--src/wallet/db.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index ae40553268..cfa9bdd20e 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -147,6 +147,7 @@ BerkeleyEnvironment::BerkeleyEnvironment(const fs::path& dir_path) : strPath(dir
BerkeleyEnvironment::~BerkeleyEnvironment()
{
+ LOCK(cs_db);
g_dbenvs.erase(strPath);
Close();
}