aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2023-08-02 17:50:16 +0200
committerPaul Adenot <[email protected]>2023-08-03 14:09:17 +0200
commit4ae9d45de2f942ef0eb3b509963374ada6285ac7 (patch)
tree4fe6542716149ca66b88f4940bfb8b760e760ff8
parentb9af56cee792f17a466db7b3ac3382262782c6f1 (diff)
downloadcubeb-4ae9d45de2f942ef0eb3b509963374ada6285ac7.tar.gz
cubeb-4ae9d45de2f942ef0eb3b509963374ada6285ac7.zip
AAudio: Don't unlock a mutex owned by a lock_guardno-unlock
-rw-r--r--src/cubeb_aaudio.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp
index 4b7774e..d0a31b2 100644
--- a/src/cubeb_aaudio.cpp
+++ b/src/cubeb_aaudio.cpp
@@ -1259,14 +1259,14 @@ aaudio_stream_init(cubeb * ctx, cubeb_stream ** stream,
// This is ok: the thread is marked as being in use
lock.unlock();
- lock_guard guard(stm->mutex);
+ int err;
+
+ {
+ lock_guard guard(stm->mutex);
+ err = aaudio_stream_init_impl(stm, guard);
+ }
- int err = aaudio_stream_init_impl(stm, guard);
if (err != CUBEB_OK) {
- // This is needed since aaudio_stream_destroy will lock the mutex again.
- // It's no problem that there is a gap in between as the stream isn't
- // actually in use.
- lock.unlock();
aaudio_stream_destroy(stm);
return err;
}