From f70eb638793daa6769fb3ddcdc11133e9aaa79ea Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 15 Feb 2019 18:20:11 +0100 Subject: [PATCH] Instance: eliminate FinishShutdownUpdate(), move code to destructor --- src/Instance.cxx | 3 +++ src/Instance.hxx | 1 - src/Main.cxx | 10 ---------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Instance.cxx b/src/Instance.cxx index a66244f5b..af3d01456 100644 --- a/src/Instance.cxx +++ b/src/Instance.cxx @@ -31,6 +31,7 @@ #ifdef ENABLE_DATABASE #include "db/DatabaseError.hxx" #include "db/Interface.hxx" +#include "db/update/Service.hxx" #include "storage/StorageInterface.hxx" #ifdef ENABLE_SQLITE @@ -53,6 +54,8 @@ Instance::Instance() Instance::~Instance() noexcept { #ifdef ENABLE_DATABASE + delete update; + if (database != nullptr) { database->Close(); delete database; diff --git a/src/Instance.hxx b/src/Instance.hxx index 996ca7475..23a3c52b9 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -167,7 +167,6 @@ struct Instance final #endif void BeginShutdownUpdate() noexcept; - void FinishShutdownUpdate() noexcept; #ifdef ENABLE_CURL void LookupRemoteTag(const char *uri) noexcept; diff --git a/src/Main.cxx b/src/Main.cxx index c2d96847c..77b20d82d 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -351,14 +351,6 @@ Instance::BeginShutdownUpdate() noexcept #endif } -inline void -Instance::FinishShutdownUpdate() noexcept -{ -#ifdef ENABLE_DATABASE - delete update; -#endif -} - inline void Instance::BeginShutdownPartitions() noexcept { @@ -634,8 +626,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config) } #endif - instance->FinishShutdownUpdate(); - #ifdef ENABLE_SQLITE sticker_global_finish(); #endif