diff --git a/rem/aumix/aumix.c b/rem/aumix/aumix.c index e034f3f2b..e7f0ced50 100644 --- a/rem/aumix/aumix.c +++ b/rem/aumix/aumix.c @@ -62,7 +62,11 @@ static void destructor(void *arg) { struct aumix *mix = arg; - if (mix->run) { + mtx_lock(&mix->mutex); + bool run = mix->run; + mtx_unlock(&mix->mutex); + + if (run) { mtx_lock(&mix->mutex); mix->run = false;