aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-03-30 13:50:50 -0700
committerChris Robinson <[email protected]>2020-03-30 13:50:50 -0700
commit167bdce48d1656569cf63448fc2328800288c38f (patch)
tree74992dca0a6ef9f9e297527ddb365d237ad08adf /alc
parent75479b58e3637e666b89a9aebf4f5a1b978b9bd0 (diff)
Hold the ListLock while opening a device
Since it may rely on the enumerated device list that could be updated asynchronously.
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 1bb859f7..691b9274 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -3700,6 +3700,7 @@ START_API_FUNC
try {
auto backend = PlaybackFactory->createBackend(device.get(), BackendType::Playback);
+ std::lock_guard<std::recursive_mutex> _{ListLock};
backend->open(deviceName);
device->Backend = std::move(backend);
}
@@ -3960,6 +3961,7 @@ START_API_FUNC
device->Frequency, device->UpdateSize, device->BufferSize);
auto backend = CaptureFactory->createBackend(device.get(), BackendType::Capture);
+ std::lock_guard<std::recursive_mutex> _{ListLock};
backend->open(deviceName);
device->Backend = std::move(backend);
}