aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-21 05:35:47 -0800
committerChris Robinson <[email protected]>2018-11-21 05:35:47 -0800
commit75213ee6f951355906bd1744a2936bb764f23e40 (patch)
treead33740d5373728f995213e60af6d06d19782ccb /OpenAL32
parent757c42c74bb1f88dfc6f24200382a0ea741fccac (diff)
Always use RAII with EffectSlotLock
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alSource.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp
index 783a9d82..3a7bc4f0 100644
--- a/OpenAL32/alSource.cpp
+++ b/OpenAL32/alSource.cpp
@@ -755,6 +755,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
ALfilter *filter = NULL;
ALeffectslot *slot = NULL;
ALbufferlistitem *oldlist;
+ std::unique_lock<almtx_t> slotlock;
ALfloat fvals[6];
switch(prop)
@@ -980,23 +981,23 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_AUXILIARY_SEND_FILTER:
- LockEffectSlotList(Context);
+ slotlock = std::unique_lock<almtx_t>{Context->EffectSlotLock};
if(!(values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL))
{
- UnlockEffectSlotList(Context);
+ slotlock.unlock();
SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid effect ID %u",
values[0]);
}
if((ALuint)values[1] >= (ALuint)device->NumAuxSends)
{
- UnlockEffectSlotList(Context);
+ slotlock.unlock();
SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid send %u", values[1]);
}
LockFilterList(device);
if(!(values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL))
{
UnlockFilterList(device);
- UnlockEffectSlotList(Context);
+ slotlock.unlock();
SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u",
values[2]);
}
@@ -1045,7 +1046,6 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
Source->Send[values[1]].Slot = slot;
DO_UPDATEPROPS();
}
- UnlockEffectSlotList(Context);
return AL_TRUE;