diff options
author | Max Kellermann <max@musicpd.org> | 2018-06-23 18:39:50 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-06-23 18:39:50 +0200 |
commit | eb93bebbc17336b88dda20c9bfa255e6d89d7f3e (patch) | |
tree | 9ea5e50a23c1639ab12eeacdbeefcfaf34774dff | |
parent | 2be905b2e23f15a0c78c89601c7624d4a10241f5 (diff) |
MusicBuffer: fix potential deadlock while cross-fading in Return()
-rw-r--r-- | src/MusicBuffer.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/MusicBuffer.cxx b/src/MusicBuffer.cxx index 2555656df..92fc9a884 100644 --- a/src/MusicBuffer.cxx +++ b/src/MusicBuffer.cxx @@ -39,6 +39,12 @@ MusicBuffer::Return(MusicChunk *chunk) noexcept { assert(chunk != nullptr); + /* these attributes need to be cleared before locking the + mutex, because they might recursively call this method, + causing a deadlock */ + chunk->next.reset(); + chunk->other.reset(); + const std::lock_guard<Mutex> protect(mutex); assert(!chunk->other || !chunk->other->other); |