From d451318bbd0bd3efc4c5519878b280b7b238d548 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 21 Jun 2016 04:10:38 +0200 Subject: [PATCH] fix(mpd): Disconnect on destruct --- src/modules/mpd.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index a3960787..3699d4ab 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -70,7 +70,15 @@ MpdModule::MpdModule(std::string name_) MpdModule::~MpdModule() { std::lock_guard lck(this->update_lock); - this->status.reset(); + { + if (this->mpd->connected()) { + try { + this->mpd->disconnect(); + } catch (mpd::Exception &e) { + get_logger()->debug(e.what()); + } + } + } } void MpdModule::start()