MusicBuffer: fix potential deadlock while cross-fading in Return()
This commit is contained in:
parent
2be905b2e2
commit
eb93bebbc1
@ -39,6 +39,12 @@ MusicBuffer::Return(MusicChunk *chunk) noexcept
|
|||||||
{
|
{
|
||||||
assert(chunk != nullptr);
|
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);
|
const std::lock_guard<Mutex> protect(mutex);
|
||||||
|
|
||||||
assert(!chunk->other || !chunk->other->other);
|
assert(!chunk->other || !chunk->other->other);
|
||||||
|
Loading…
Reference in New Issue
Block a user