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.
This commit is contained in:
parent
efb6ddef9c
commit
712d35bc56
1 changed files with 1 additions and 0 deletions
|
@ -147,6 +147,7 @@ BerkeleyEnvironment::BerkeleyEnvironment(const fs::path& dir_path) : strPath(dir
|
||||||
|
|
||||||
BerkeleyEnvironment::~BerkeleyEnvironment()
|
BerkeleyEnvironment::~BerkeleyEnvironment()
|
||||||
{
|
{
|
||||||
|
LOCK(cs_db);
|
||||||
g_dbenvs.erase(strPath);
|
g_dbenvs.erase(strPath);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue