aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-02-01 21:09:13 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-02-01 21:13:08 +0000
commit712d35bc563ac7de0b7dfc3a35fc48dc6448fa6a (patch)
treed7d4bdadfc9a51446178bab706f26201e48cc2a7 /src
parentefb6ddef9cb341428cbedf4373d1bdd19685a827 (diff)
downloadbitcoin-712d35bc563ac7de0b7dfc3a35fc48dc6448fa6a.tar.xz
wallet: Add missing cs_db lock
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.
Diffstat (limited to 'src')
-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();
}