MusicBuffer: fix potential deadlock while cross-fading in Return()

This commit is contained in:
Max Kellermann 2018-06-23 18:39:50 +02:00
parent 2be905b2e2
commit eb93bebbc1

View File

@ -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);