aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-03 12:14:50 -0700
committerChris Robinson <[email protected]>2019-08-03 12:14:50 -0700
commit341743680415c4b3339d36fc4e67ab8a605a06ea (patch)
tree83d380f385a7ac47be52ad1013a68a1e4c20cf1c /alc
parenta7a9c00275ee6ebe0ee543b9698f16ace8f5d35c (diff)
Avoid manually incrementing a reference count
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 3b2ed7a4..c9520c6d 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -3391,8 +3391,7 @@ START_API_FUNC
{
std::lock_guard<std::recursive_mutex> _{ListLock};
auto iter = std::lower_bound(ContextList.cbegin(), ContextList.cend(), context.get());
- context->add_ref();
- ContextList.insert(iter, ContextRef{context.get()});
+ ContextList.emplace(iter, context);
}
if(context->mDefaultSlot)
@@ -3739,8 +3738,7 @@ START_API_FUNC
{
std::lock_guard<std::recursive_mutex> _{ListLock};
auto iter = std::lower_bound(DeviceList.cbegin(), DeviceList.cend(), device.get());
- device->add_ref();
- DeviceList.insert(iter, DeviceRef{device.get()});
+ DeviceList.emplace(iter, device);
}
TRACE("Created device %p, \"%s\"\n", device.get(), device->DeviceName.c_str());
@@ -3865,8 +3863,7 @@ START_API_FUNC
{
std::lock_guard<std::recursive_mutex> _{ListLock};
auto iter = std::lower_bound(DeviceList.cbegin(), DeviceList.cend(), device.get());
- device->add_ref();
- DeviceList.insert(iter, DeviceRef{device.get()});
+ DeviceList.emplace(iter, device);
}
TRACE("Created device %p, \"%s\"\n", device.get(), device->DeviceName.c_str());
@@ -4034,8 +4031,7 @@ START_API_FUNC
{
std::lock_guard<std::recursive_mutex> _{ListLock};
auto iter = std::lower_bound(DeviceList.cbegin(), DeviceList.cend(), device.get());
- device->add_ref();
- DeviceList.insert(iter, DeviceRef{device.get()});
+ DeviceList.emplace(iter, device);
}
TRACE("Created device %p\n", device.get());