From 9849d12009126b920c8d6a320e047661eb6259c4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 28 Mar 2022 20:36:57 +0200 Subject: [PATCH] data-loop: check running state in _in_thread() We can only be in the thread when the thread is running. --- src/pipewire/data-loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipewire/data-loop.c b/src/pipewire/data-loop.c index 30dbb85c9..c0d349eb2 100644 --- a/src/pipewire/data-loop.c +++ b/src/pipewire/data-loop.c @@ -246,7 +246,7 @@ int pw_data_loop_stop(struct pw_data_loop *loop) SPA_EXPORT bool pw_data_loop_in_thread(struct pw_data_loop * loop) { - return pthread_equal(loop->thread, pthread_self()); + return loop->running && pthread_equal(loop->thread, pthread_self()); } /** Get the thread object.