From 616519d704b8f43f240c2cef1fc2b1500d5a0bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 4 Mar 2022 16:53:26 +0100 Subject: [PATCH] spa: support: loop: assert loop is not polling when source is removed `spa_source`s whose backing storage is not managed by the loop cannot be safely removed while the loop is polling. Assert that it does not happen. --- spa/plugins/support/loop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c index 02ad8e359..9f013f21a 100644 --- a/spa/plugins/support/loop.c +++ b/spa/plugins/support/loop.c @@ -155,7 +155,10 @@ static int remove_from_poll(struct impl *impl, struct spa_source *source) static int loop_remove_source(void *object, struct spa_source *source) { - int res = remove_from_poll(object, source); + struct impl *impl = object; + spa_assert(!impl->polling); + + int res = remove_from_poll(impl, source); detach_source(source); return res;