diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-07-29 12:19:33 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-07-29 12:19:33 +0200 |
commit | d2452e1340038539bfbe3948fe61fe8a7b214f85 (patch) | |
tree | c247573c55de47ae698b43e2619c37b5610900ca | |
parent | e32a7a8d652ef5d8e1f59cd1a41586e64f3acf52 (diff) |
acp-device: remove sources when destroyed
Or we end up polling wrong fds in an infinite loop.
-rw-r--r-- | spa/plugins/alsa/alsa-acp-device.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/spa/plugins/alsa/alsa-acp-device.c b/spa/plugins/alsa/alsa-acp-device.c index 757cd450..12812e54 100644 --- a/spa/plugins/alsa/alsa-acp-device.c +++ b/spa/plugins/alsa/alsa-acp-device.c @@ -99,13 +99,20 @@ static void handle_acp_poll(struct spa_source *source) this->sources[i].rmask = 0; } -static int setup_sources(struct impl *this) +static void remove_sources(struct impl *this) { int i; - for (i = 0; i < this->n_pfds; i++) { spa_loop_remove_source(this->loop, &this->sources[i]); } + this->n_pfds = 0; +} + +static int setup_sources(struct impl *this) +{ + int i; + + remove_sources(this); this->n_pfds = acp_card_poll_descriptors(this->card, this->pfds, MAX_POLL); @@ -774,6 +781,8 @@ static SPA_PRINTF_FUNC(6,0) void impl_acp_log_func(void *data, static int impl_clear(struct spa_handle *handle) { + struct impl *this = (struct impl *) handle; + remove_sources(this); return 0; } |