aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2018-07-13 19:15:30 -0700
committerAndrew Chow <achow101-github@achow101.com>2018-08-09 11:27:39 -0700
commita769461d5e37ddcb771ae836254fdc69177a28c4 (patch)
treee3d465a596a7dedfe0555ddcce113df32c034ca6 /src
parentf66e1c793eda7a6143fd03400c98512a9b6f00c7 (diff)
Move BerkeleyEnvironment deletion from internal method to callsite
Instead of having the object destroy itself, having the caller destroy it.
Diffstat (limited to 'src')
-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 d0fe51801e..536243be4f 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -697,7 +697,6 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
if (!fMockDb) {
fs::remove_all(fs::path(strPath) / "database");
}
- g_dbenvs.erase(strPath);
}
}
}
@@ -796,6 +795,10 @@ 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;
+ }
}
}