Move BerkeleyEnvironment deletion from internal method to callsite
Instead of having the object destroy itself, having the caller destroy it.
This commit is contained in:
parent
f66e1c793e
commit
a769461d5e
1 changed files with 5 additions and 2 deletions
|
@ -697,7 +697,6 @@ void BerkeleyEnvironment::Flush(bool fShutdown)
|
||||||
if (!fMockDb) {
|
if (!fMockDb) {
|
||||||
fs::remove_all(fs::path(strPath) / "database");
|
fs::remove_all(fs::path(strPath) / "database");
|
||||||
}
|
}
|
||||||
g_dbenvs.erase(strPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -796,6 +795,10 @@ void BerkeleyDatabase::Flush(bool shutdown)
|
||||||
{
|
{
|
||||||
if (!IsDummy()) {
|
if (!IsDummy()) {
|
||||||
env->Flush(shutdown);
|
env->Flush(shutdown);
|
||||||
if (shutdown) env = nullptr;
|
if (shutdown) {
|
||||||
|
LOCK(cs_db);
|
||||||
|
g_dbenvs.erase(env->Directory().string());
|
||||||
|
env = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue