From c724fcae2e6549b8bddfb5b3e4248b3953634a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 26 Jun 2023 20:54:04 +0200 Subject: [PATCH] tests/screen-cast-client: Don't process stream on tear down We'd get a re-entry like scenario when destroying the PipeWire stream object, where PipeWire would call the stream process vfunc. When this happened, we had already destroyed the stream, so don't try to dequeue or anything, just do an early exit. Fixes the following crash in the test case client: #0 pw_stream_dequeue_buffer() in /usr/lib64/libpipewire-0.3.so.0.367.0 #1 on_stream_process() at ../src/tests/screen-cast-client.c:348 #2 do_call_process() in /usr/lib64/libpipewire-0.3.so.0.367.0 #3 flush_items() in /usr/lib64/spa-0.2/support/libspa-support.so #4 loop_invoke() in /usr/lib64/spa-0.2/support/libspa-support.so #5 impl_send_command.lto_priv.0() in /usr/lib64/libpipewire-0.3.so.0.367.0 #6 suspend_node.lto_priv.0() in /usr/lib64/libpipewire-0.3.so.0.367.0 #7 pw_impl_node_set_state() in /usr/lib64/libpipewire-0.3.so.0.367.0 #8 client_node_removed() in /usr/lib64/pipewire-0.3/libpipewire-module-client-node.so #9 pw_proxy_destroy() in /usr/lib64/libpipewire-0.3.so.0.367.0 #10 pw_stream_disconnect() in /usr/lib64/libpipewire-0.3.so.0.367.0 #11 pw_stream_destroy() in /usr/lib64/libpipewire-0.3.so.0.367.0 #12 stream_free() at ../src/tests/screen-cast-client.c:530 #13 main() at ../src/tests/screen-cast-client.c:803 #14 __libc_start_call_main() at ../sysdeps/nptl/libc_start_call_main.h:58 #15 __libc_start_main() at ../csu/libc-start.c:360 #16 _start() in /home/jonas/Dev/gnome/mutter/build/src/tests/mutter-screen-cast-client Part-of: --- src/tests/screen-cast-client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tests/screen-cast-client.c b/src/tests/screen-cast-client.c index d7ed3f99b..3c5bb2076 100644 --- a/src/tests/screen-cast-client.c +++ b/src/tests/screen-cast-client.c @@ -345,6 +345,9 @@ on_stream_process (void *user_data) struct pw_buffer *next_buffer; struct pw_buffer *buffer = NULL; + if (!stream->pipewire_stream) + return; + next_buffer = pw_stream_dequeue_buffer (stream->pipewire_stream); if (next_buffer) g_debug ("Dequeued buffer, queue previous");