From 127ec026e7dd0722bd5fbc193a85cb28a95925f5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 25 Nov 2018 16:13:07 -0800 Subject: Automatically clean up filters and effects with their sublists --- OpenAL32/alEffect.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'OpenAL32/alEffect.cpp') diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index 2bc60e24..7f479c83 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -571,26 +571,18 @@ void InitEffect(ALeffect *effect) InitEffectParams(effect, AL_EFFECT_NULL); } -void ReleaseALEffects(ALCdevice *device) +EffectSubList::~EffectSubList() { - size_t leftover = 0; - for(auto &sublist : device->EffectList) + ALuint64 usemask = ~FreeMask; + while(usemask) { - ALuint64 usemask = ~sublist.FreeMask; - while(usemask) - { - ALsizei idx = CTZ64(usemask); - ALeffect *effect = sublist.Effects + idx; - - effect->~ALeffect(); - ++leftover; - - usemask &= ~(U64(1) << idx); - } - sublist.FreeMask = ~usemask; + ALsizei idx = CTZ64(usemask); + Effects[idx].~ALeffect(); + usemask &= ~(U64(1) << idx); } - if(leftover > 0) - WARN("(%p) Deleted " SZFMT " Effect%s\n", device, leftover, (leftover==1)?"":"s"); + FreeMask = ~usemask; + al_free(Effects); + Effects = nullptr; } -- cgit v1.2.3