From 7e4dd9524fa1a108014fabe4cb1c7e9be644fb84 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 24 Apr 2025 13:21:07 +0200 Subject: [PATCH] alsa-seq: add the source only on success Otherwise if we have an error with the timerfd, we have the source fd added and we close the device. --- spa/plugins/alsa/alsa-seq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index 3b740f47e..9cb707814 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -404,7 +404,6 @@ int spa_alsa_seq_open(struct seq_state *state) state->sys.source.func = alsa_seq_on_sys; state->sys.source.data = state; - spa_loop_add_source(state->main_loop, &state->sys.source); /* increase event queue timer resolution */ snd_seq_queue_timer_alloca(&timer); @@ -449,6 +448,8 @@ int spa_alsa_seq_open(struct seq_state *state) state->timerfd = res; + spa_loop_add_source(state->main_loop, &state->sys.source); + state->opened = true; return 0;