From 54933b67fd71f44c5fa6d627a5b12c928d2cb8ae Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 7 Mar 2022 10:27:22 +0100 Subject: [PATCH] loop: clean polling flag when leaving the loop When we leave the last recursive enter of the loop, clear the polling flag. It might be possible that it was not cleared because the loop might have been killed with pthread_kill. In any case, the _leave calls need to be made in this case as well. This fixes issues when jack clients stop because it triggers and assert because the polling flag is still active when the object is cleared. See !1171 --- spa/plugins/support/loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index ed2815bbf..f461c09f8 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -348,8 +348,10 @@ static void loop_leave(void *object) spa_log_trace(impl->log, "%p: leave %lu", impl, impl->thread); - if (--impl->enter_count == 0) + if (--impl->enter_count == 0) { impl->thread = 0; + impl->polling = false; + } } static inline void free_source(struct source_impl *s)