From 712d35bc563ac7de0b7dfc3a35fc48dc6448fa6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Fri, 1 Feb 2019 21:09:13 +0000 Subject: 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. --- src/wallet/db.cpp | 1 + 1 file changed, 1 insertion(+) 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(); } -- cgit v1.2.3