From 2229e866730646cbc8334c598d3b6651ade4cf3e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 12 Mar 2020 19:54:03 +0100 Subject: [PATCH] client/Expire: cancel the BackgroundCommand before deleting it Fixes assertion failure. Closes https://github.com/MusicPlayerDaemon/MPD/issues/774 --- src/client/Expire.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/Expire.cxx b/src/client/Expire.cxx index f51dd42a4..0c2c4e269 100644 --- a/src/client/Expire.cxx +++ b/src/client/Expire.cxx @@ -28,7 +28,10 @@ Client::SetExpired() noexcept if (IsExpired()) return; - background_command.reset(); + if (background_command) { + background_command->Cancel(); + background_command.reset(); + } FullyBufferedSocket::Close(); timeout_event.Schedule(std::chrono::steady_clock::duration::zero());