Skip to content

Commit

Permalink
pcm: close - deactivate async handler before snd_pcm_drop()
Browse files Browse the repository at this point in the history
It reduces probablity to activate the async handler when snd_pcm_close() is called.

Link: #394
Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
perexg committed Sep 6, 2024
1 parent 513ef7a commit 93d7645
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pcm/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,10 @@ int snd_pcm_close(snd_pcm_t *pcm)
{
int res = 0, err;
assert(pcm);
while (!list_empty(&pcm->async_handlers)) {
snd_async_handler_t *h = list_entry(pcm->async_handlers.next, snd_async_handler_t, hlist);
snd_async_del_handler(h);
}
if (pcm->setup && !pcm->donot_close) {
snd_pcm_drop(pcm);
err = snd_pcm_hw_free(pcm);
Expand All @@ -785,10 +789,6 @@ int snd_pcm_close(snd_pcm_t *pcm)
}
if (pcm->mmap_channels)
snd_pcm_munmap(pcm);
while (!list_empty(&pcm->async_handlers)) {
snd_async_handler_t *h = list_entry(pcm->async_handlers.next, snd_async_handler_t, hlist);
snd_async_del_handler(h);
}
if (pcm->ops->close)
err = pcm->ops->close(pcm->op_arg);
else
Expand Down

0 comments on commit 93d7645

Please sign in to comment.