From 0135baa60fe79e11080d5a3c92c1396b61044b5b 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 eb12bde29..dac268376 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;