From 33bcced82a1e97811d4212195b6e6ca9cf2242b1 Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat@gmail.com>
Date: Thu, 1 Aug 2019 19:44:09 -0700
Subject: Use a smart pointer for holding the context's device

---
 al/filter.cpp | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'al/filter.cpp')

diff --git a/al/filter.cpp b/al/filter.cpp
index 5009daae..b52267f1 100644
--- a/al/filter.cpp
+++ b/al/filter.cpp
@@ -278,7 +278,7 @@ void InitFilterParams(ALfilter *filter, ALenum type)
 
 ALfilter *AllocFilter(ALCcontext *context)
 {
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
     auto sublist = std::find_if(device->FilterList.begin(), device->FilterList.end(),
         [](const FilterSubList &entry) noexcept -> bool
@@ -410,7 +410,7 @@ START_API_FUNC
     if(UNLIKELY(n == 0))
         return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     /* First try to find any filters that are invalid. */
@@ -448,7 +448,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(LIKELY(context))
     {
-        ALCdevice *device{context->mDevice};
+        ALCdevice *device{context->mDevice.get()};
         std::lock_guard<std::mutex> _{device->FilterLock};
         if(!filter || LookupFilter(device, filter))
             return AL_TRUE;
@@ -464,7 +464,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -502,7 +502,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -522,7 +522,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -542,7 +542,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -562,7 +562,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -594,7 +594,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -614,7 +614,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
@@ -634,7 +634,7 @@ START_API_FUNC
     ContextRef context{GetContextRef()};
     if(UNLIKELY(!context)) return;
 
-    ALCdevice *device{context->mDevice};
+    ALCdevice *device{context->mDevice.get()};
     std::lock_guard<std::mutex> _{device->FilterLock};
 
     ALfilter *alfilt{LookupFilter(device, filter)};
-- 
cgit v1.2.3