diff options
-rw-r--r-- | al/auxeffectslot.cpp | 8 | ||||
-rw-r--r-- | alc/alu.cpp | 6 | ||||
-rw-r--r-- | core/effectslot.h | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 0f0a20f8..5f58d730 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -917,7 +917,7 @@ ALeffectslot::ALeffectslot(ALCcontext *context) mSlot = context->getEffectSlot(); mSlot->InUse = true; - mSlot->mEffectState = state.release(); + mSlot->mEffectState = std::move(state); } ALeffectslot::~ALeffectslot() @@ -929,16 +929,14 @@ ALeffectslot::~ALeffectslot() DecrementRef(Buffer->ref); Buffer = nullptr; - EffectSlotProps *props{mSlot->Update.exchange(nullptr)}; - if(props) + if(EffectSlotProps *props{mSlot->Update.exchange(nullptr)}) { TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n", decltype(std::declval<void*>()){props}); delete props; } - if(mSlot->mEffectState) - mSlot->mEffectState->release(); + mSlot->mEffectState = nullptr; mSlot->InUse = false; } diff --git a/alc/alu.cpp b/alc/alu.cpp index 254fe4b5..f5504b5a 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -444,8 +444,8 @@ bool CalcEffectSlotParams(EffectSlot *slot, EffectSlot **sorted_slots, ContextBa } EffectState *state{props->State.release()}; - EffectState *oldstate{slot->mEffectState}; - slot->mEffectState = state; + EffectState *oldstate{slot->mEffectState.release()}; + slot->mEffectState.reset(state); /* Only release the old state if it won't get deleted, since we can't be * deleting/freeing anything in the mixer. @@ -1775,7 +1775,7 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo) for(const EffectSlot *slot : sorted_slots) { - EffectState *state{slot->mEffectState}; + EffectState *state{slot->mEffectState.get()}; state->process(SamplesToDo, slot->Wet.Buffer, state->mOutTarget); } } diff --git a/core/effectslot.h b/core/effectslot.h index affbccb0..2624ae5f 100644 --- a/core/effectslot.h +++ b/core/effectslot.h @@ -68,7 +68,7 @@ struct EffectSlot { EffectSlotType EffectType{EffectSlotType::None}; EffectProps mEffectProps{}; - EffectState *mEffectState{nullptr}; + al::intrusive_ptr<EffectState> mEffectState; float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */ float DecayTime{0.0f}; |