From e56166cf75aff15eda05be5c33825bd926b9ccb2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 16 Jan 2015 13:26:42 +0100 Subject: Fixed storage removal. We have to remove any open environments as well. --- common/storage_lmdb.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 2dc4817..591d761 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp @@ -396,12 +396,14 @@ qint64 Storage::diskUsage() const void Storage::removeFromDisk() const { - QDir dir(d->storageRoot + '/' + d->name); - // dir.remove("data.mdb"); - // dir.remove("lock.mdb"); + const QString fullPath(d->storageRoot + '/' + d->name); + QMutexLocker locker(&d->sMutex); + QDir dir(fullPath); if (!dir.removeRecursively()) { qWarning() << "Failed to remove directory" << d->storageRoot << d->name; } + auto env = d->sEnvironments.take(fullPath); + delete env; } } // namespace Akonadi2 -- cgit v1.2.3