From 81d61d3dcebd3a07b337206577ae5444ddcbe9e2 Mon Sep 17 00:00:00 2001 From: Jin Li Date: Tue, 15 Sep 2026 11:42:05 +0000 Subject: [PATCH] async: fix snd_async_del_handler for TIMER type snd_async_del_handler() has two switch statements that handle PCM and CTL handler types, but not TIMER. When a TIMER type handler is deleted, both switches fall through to default and trigger assert(0), crashing any program that uses snd_async_add_timer_handler(). Add the missing SND_ASYNC_HANDLER_TIMER cases to both switches, and include timer_local.h to access struct _snd_timer. Signed-off-by: Jin Li --- src/async.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/async.c b/src/async.c index 989738ec..55bc312c 100644 --- a/src/async.c +++ b/src/async.c @@ -26,6 +26,7 @@ #include "pcm/pcm_local.h" #include "control/control_local.h" +#include "timer/timer_local.h" #include static struct sigaction previous_action; @@ -162,6 +163,9 @@ int snd_async_del_handler(snd_async_handler_t *handler) case SND_ASYNC_HANDLER_CTL: alist = &handler->u.ctl->async_handlers; break; + case SND_ASYNC_HANDLER_TIMER: + alist = &handler->u.timer->async_handlers; + break; default: assert(0); } @@ -178,6 +182,9 @@ int snd_async_del_handler(snd_async_handler_t *handler) case SND_ASYNC_HANDLER_CTL: err2 = snd_ctl_async(handler->u.ctl, -1, 1); break; + case SND_ASYNC_HANDLER_TIMER: + err2 = snd_timer_async(handler->u.timer, -1, 1); + break; default: assert(0); }