client/Expire: cancel the BackgroundCommand before deleting it

Fixes assertion failure.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/774
This commit is contained in:
Max Kellermann 2020-03-12 19:54:03 +01:00
parent f24c274f5c
commit 2229e86673
1 changed files with 4 additions and 1 deletions

View File

@ -28,7 +28,10 @@ Client::SetExpired() noexcept
if (IsExpired()) if (IsExpired())
return; return;
background_command.reset(); if (background_command) {
background_command->Cancel();
background_command.reset();
}
FullyBufferedSocket::Close(); FullyBufferedSocket::Close();
timeout_event.Schedule(std::chrono::steady_clock::duration::zero()); timeout_event.Schedule(std::chrono::steady_clock::duration::zero());