Skip to content

Commit

Permalink
AAudio: Don't unlock a mutex owned by a lock_guard
Browse files Browse the repository at this point in the history
  • Loading branch information
padenot committed Aug 3, 2023
1 parent b9af56c commit ac8474a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cubeb_aaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ac8474a

Please sign in to comment.