diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 1 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 11 |
2 files changed, 5 insertions, 7 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 57eee33d..cd4b7174 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -343,6 +343,7 @@ void ResetUIntMap(UIntMap *map); ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); void RemoveUIntMapKey(UIntMap *map, ALuint key); ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); +ALvoid *PopUIntMapValue(UIntMap *map, ALuint key); static __inline void LockUIntMapRead(UIntMap *map) { ReadLock(&map->lock); } diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index a0988e5d..e45cbcd9 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -51,6 +51,7 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum eName, ALdouble *Offsets, static ALint GetByteOffset(ALsource *Source); #define LookupSource(m, k) ((ALsource*)LookupUIntMapKey(&(m), (k))) +#define RemoveSource(m, k) ((ALsource*)PopUIntMapValue(&(m), (k))) #define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k))) #define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k))) #define LookupEffectSlot(m, k) ((ALeffectslot*)LookupUIntMapKey(&(m), (k))) @@ -143,17 +144,13 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) { ALsource **srclist, **srclistend; - LockContext(Context); - if((Source=LookupSource(Context->SourceMap, sources[i])) == NULL) - { - UnlockContext(Context); + // Remove Source from list of Sources + if((Source=RemoveSource(Context->SourceMap, sources[i])) == NULL) continue; - } - // Remove Source from list of Sources - RemoveUIntMapKey(&Context->SourceMap, Source->source); FreeThunkEntry(Source->source); + LockContext(Context); srclist = Context->ActiveSources; srclistend = srclist + Context->ActiveSourceCount; while(srclist != srclistend) |