summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-20 10:32:59 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-20 10:32:59 +0200
commit026476a61bc526a14606ac6acdf747c3aad9380c (patch)
tree5474e88a8c9b1b3700c1c21c51e918fee1e18e52
parentfe20a710618bb01e03f9f3e7b925799be73a0ab9 (diff)
downloadsink-026476a61bc526a14606ac6acdf747c3aad9380c.tar.gz
sink-026476a61bc526a14606ac6acdf747c3aad9380c.zip
Actually close the lmdb environment before removing from disk.
Otherwise removal doesn't work on windows due to open file handles.
-rw-r--r--common/storage_lmdb.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp
index ddb4f84..660326a 100644
--- a/common/storage_lmdb.cpp
+++ b/common/storage_lmdb.cpp
@@ -974,13 +974,12 @@ void DataStore::removeFromDisk() const
974 QWriteLocker dbiLocker(&sDbisLock); 974 QWriteLocker dbiLocker(&sDbisLock);
975 QWriteLocker envLocker(&sEnvironmentsLock); 975 QWriteLocker envLocker(&sEnvironmentsLock);
976 SinkTrace() << "Removing database from disk: " << fullPath; 976 SinkTrace() << "Removing database from disk: " << fullPath;
977 sEnvironments.take(fullPath); 977 auto env = sEnvironments.take(fullPath);
978 for (const auto &key : sDbis.keys()) { 978 for (const auto &key : sDbis.keys()) {
979 if (key.startsWith(d->name)) { 979 if (key.startsWith(d->name)) {
980 sDbis.remove(key); 980 sDbis.remove(key);
981 } 981 }
982 } 982 }
983 auto env = sEnvironments.take(fullPath);
984 mdb_env_close(env); 983 mdb_env_close(env);
985 QDir dir(fullPath); 984 QDir dir(fullPath);
986 if (!dir.removeRecursively()) { 985 if (!dir.removeRecursively()) {