aboutsummaryrefslogtreecommitdiffstats
path: root/al/auxeffectslot.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-08-22 22:45:26 -0700
committerChris Robinson <[email protected]>2020-08-24 14:09:26 -0700
commitff5c9d1c15302473be7e0ea3b5da2643549e8d6c (patch)
tree9e8e1f07cd2a1c28fd3bc75f41f1cd552c570079 /al/auxeffectslot.cpp
parent01f76f2b671c21c976b1f88c18845a53000afa6b (diff)
Use an intrusive_ptr for ALeffectslotProps::State
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r--al/auxeffectslot.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 7c20ec64..00da51f6 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -640,7 +640,6 @@ ALeffectslot::~ALeffectslot()
ALeffectslotProps *props{Params.Update.load()};
if(props)
{
- if(props->State) props->State->release();
TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n",
decltype(std::declval<void*>()){props});
delete props;
@@ -707,8 +706,6 @@ ALenum ALeffectslot::initEffect(ALeffect *effect, ALCcontext *context)
ALeffectslotProps *props{context->mFreeEffectslotProps.load()};
while(props)
{
- if(props->State)
- props->State->release();
props->State = nullptr;
props = props->next.load(std::memory_order_relaxed);
}
@@ -741,9 +738,8 @@ void ALeffectslot::updateProps(ALCcontext *context)
/* Swap out any stale effect state object there may be in the container, to
* delete it.
*/
- EffectState *oldstate{props->State};
Effect.State->add_ref();
- props->State = Effect.State;
+ props->State.reset(Effect.State);
/* Set the new container for updating internal parameters. */
props = Params.Update.exchange(props, std::memory_order_acq_rel);
@@ -752,14 +748,9 @@ void ALeffectslot::updateProps(ALCcontext *context)
/* If there was an unused update container, put it back in the
* freelist.
*/
- if(props->State)
- props->State->release();
props->State = nullptr;
AtomicReplaceHead(context->mFreeEffectslotProps, props);
}
-
- if(oldstate)
- oldstate->release();
}
void UpdateAllEffectSlotProps(ALCcontext *context)