aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-12-08 06:22:55 -0800
committerChris Robinson <[email protected]>2022-12-08 06:22:55 -0800
commitb0be3bf883c147a87840b880a6b0a8db36333b6a (patch)
treea1c8bef78fe66a3d431609f3d3ffd3616790282e
parent4c2a96e2c856c07aead4ea5679d27310743b45ae (diff)
Rename a potentially confusing member function
-rw-r--r--al/event.cpp2
-rw-r--r--alc/context.cpp4
-rw-r--r--common/intrusive_ptr.h12
-rw-r--r--core/hrtf.cpp2
-rw-r--r--core/hrtf.h2
5 files changed, 11 insertions, 11 deletions
diff --git a/al/event.cpp b/al/event.cpp
index 1ec404da..8765e79b 100644
--- a/al/event.cpp
+++ b/al/event.cpp
@@ -59,7 +59,7 @@ static int EventThread(ALCcontext *context)
if(evt.EnumType == AsyncEvent::ReleaseEffectState)
{
- evt.u.mEffectState->release();
+ al::intrusive_ptr<EffectState>{evt.u.mEffectState};
continue;
}
diff --git a/alc/context.cpp b/alc/context.cpp
index 07ae6434..906a160e 100644
--- a/alc/context.cpp
+++ b/alc/context.cpp
@@ -198,12 +198,12 @@ bool ALCcontext::deinit()
{
WARN("%p released while current on thread\n", voidp{this});
sThreadContext.set(nullptr);
- release();
+ dec_ref();
}
ALCcontext *origctx{this};
if(sGlobalContext.compare_exchange_strong(origctx, nullptr))
- release();
+ dec_ref();
bool ret{};
/* First make sure this context exists in the device's list. */
diff --git a/common/intrusive_ptr.h b/common/intrusive_ptr.h
index 5e65ba78..84d18aa0 100644
--- a/common/intrusive_ptr.h
+++ b/common/intrusive_ptr.h
@@ -15,7 +15,7 @@ class intrusive_ref {
public:
unsigned int add_ref() noexcept { return IncrementRef(mRef); }
- unsigned int release() noexcept
+ unsigned int dec_ref() noexcept
{
auto ref = DecrementRef(mRef);
if(ref == 0) [[unlikely]]
@@ -58,14 +58,14 @@ public:
{ rhs.mPtr = nullptr; }
intrusive_ptr(std::nullptr_t) noexcept { }
explicit intrusive_ptr(T *ptr) noexcept : mPtr{ptr} { }
- ~intrusive_ptr() { if(mPtr) mPtr->release(); }
+ ~intrusive_ptr() { if(mPtr) mPtr->dec_ref(); }
intrusive_ptr& operator=(const intrusive_ptr &rhs) noexcept
{
- static_assert(noexcept(std::declval<T*>()->release()), "release must be noexcept");
+ static_assert(noexcept(std::declval<T*>()->dec_ref()), "dec_ref must be noexcept");
if(rhs.mPtr) rhs.mPtr->add_ref();
- if(mPtr) mPtr->release();
+ if(mPtr) mPtr->dec_ref();
mPtr = rhs.mPtr;
return *this;
}
@@ -73,7 +73,7 @@ public:
{
if(&rhs != this) [[likely]]
{
- if(mPtr) mPtr->release();
+ if(mPtr) mPtr->dec_ref();
mPtr = std::exchange(rhs.mPtr, nullptr);
}
return *this;
@@ -88,7 +88,7 @@ public:
void reset(T *ptr=nullptr) noexcept
{
if(mPtr)
- mPtr->release();
+ mPtr->dec_ref();
mPtr = ptr;
}
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index 383d4340..2b3fdc13 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -1433,7 +1433,7 @@ void HrtfStore::add_ref()
TRACE("HrtfStore %p increasing refcount to %u\n", decltype(std::declval<void*>()){this}, ref);
}
-void HrtfStore::release()
+void HrtfStore::dec_ref()
{
auto ref = DecrementRef(mRef);
TRACE("HrtfStore %p decreasing refcount to %u\n", decltype(std::declval<void*>()){this}, ref);
diff --git a/core/hrtf.h b/core/hrtf.h
index 193576e7..0c8d2a49 100644
--- a/core/hrtf.h
+++ b/core/hrtf.h
@@ -42,7 +42,7 @@ struct HrtfStore {
const ubyte2 *delays;
void add_ref();
- void release();
+ void dec_ref();
DEF_PLACE_NEWDEL()
};