summaryrefslogtreecommitdiff
path: root/src/Instance.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-02-15 18:03:43 +0100
committerMax Kellermann <max@musicpd.org>2019-02-15 18:04:23 +0100
commit99c23cf13993cde427f66a9dd6e433bdc7c63963 (patch)
treef300813aaa8c047e2de6f7fc9049cda0ffe0886f /src/Instance.cxx
parent9aa75e738cb98d3f9794300d2eea20027c603c48 (diff)
Instance: eliminate ShutdownDatabase(), move code to destructor
Destruct automatically, even if leaving the scope due to exception being thrown.
Diffstat (limited to 'src/Instance.cxx')
-rw-r--r--src/Instance.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Instance.cxx b/src/Instance.cxx
index f1beeeff6..a66244f5b 100644
--- a/src/Instance.cxx
+++ b/src/Instance.cxx
@@ -30,6 +30,8 @@
#ifdef ENABLE_DATABASE
#include "db/DatabaseError.hxx"
+#include "db/Interface.hxx"
+#include "storage/StorageInterface.hxx"
#ifdef ENABLE_SQLITE
#include "sticker/StickerDatabase.hxx"
@@ -48,7 +50,17 @@ Instance::Instance()
{
}
-Instance::~Instance() noexcept = default;
+Instance::~Instance() noexcept
+{
+#ifdef ENABLE_DATABASE
+ if (database != nullptr) {
+ database->Close();
+ delete database;
+ }
+
+ delete storage;
+#endif
+}
Partition *
Instance::FindPartition(const char *name) noexcept