aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alu.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-04 20:31:55 -0700
committerChris Robinson <[email protected]>2019-09-04 20:31:55 -0700
commitc47a6d2279b80031db9b012713c27885b2d14047 (patch)
treeb853b21f7c702d684b8206b4f69e349025a1003c /alc/alu.cpp
parente873165019e8ae9300be9066101554c18a29df83 (diff)
Increment the mix count during disconnect
So attempts to get the current playback offset behave correctly while disconnecting.
Diffstat (limited to 'alc/alu.cpp')
-rw-r--r--alc/alu.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 3cf7f4cf..861929ef 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -1732,6 +1732,7 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
if(msglen < 0 || static_cast<size_t>(msglen) >= sizeof(evt.u.user.msg))
evt.u.user.msg[sizeof(evt.u.user.msg)-1] = 0;
+ IncrementRef(device->MixCount);
for(ALCcontext *ctx : *device->mContexts.load())
{
const ALbitfieldSOFT enabledevt{ctx->mEnabledEvts.load(std::memory_order_acquire)};
@@ -1741,7 +1742,7 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
auto evt_data = ring->getWriteVector().first;
if(evt_data.len > 0)
{
- new (evt_data.buf) AsyncEvent{evt};
+ ::new (evt_data.buf) AsyncEvent{evt};
ring->writeAdvance(1);
ctx->mEventSem.post();
}
@@ -1758,4 +1759,5 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
ctx->mVoices->begin() + ctx->mVoiceCount.load(std::memory_order_acquire),
stop_voice);
}
+ IncrementRef(device->MixCount);
}