aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2018-07-13 19:15:30 -0700
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-03-11 13:20:22 +0000
commit435df68c62562e30a6d11b0bfc2cf56434dbc4a0 (patch)
tree96b9d1179fc35a8b46884157868ae5d62ae87fac
parent048fda2a66df405cd98706612c87b59c2912c441 (diff)
downloadbitcoin-435df68c62562e30a6d11b0bfc2cf56434dbc4a0.tar.xz
Move BerkeleyEnvironment deletion from internal method to callsite
Instead of having the object destroy itself, having the caller destroy it. Github-Pull: #12493 Rebased-From: a769461
-rw-r--r--src/wallet/db.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index 679cb200b7..2d57c92ccc 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -724,7 +724,6 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
if (!fMockDb) {
fs::remove_all(fs::path(strPath) / "database");
}
- g_dbenvs.erase(strPath);
}
}
}
@@ -823,7 +822,11 @@ void BerkeleyDatabase::Flush(bool shutdown)
{
if (!IsDummy()) {
env->Flush(shutdown);
- if (shutdown) env = nullptr;
+ if (shutdown) {
+ LOCK(cs_db);
+ g_dbenvs.erase(env->Directory().string());
+ env = nullptr;
+ }
}
}