pipewire/spa/plugins/support
Barnabás Pőcze 479896279e spa: support: loop: handle cancellation better
Register a pthread cleanup handler to guarantee
that `spa_source::{priv, rmask}` are cleared even
if the thread is cancelled while the loop is dispatching.

This is necessary, otherwise `spa_source::priv` could point
to the stack of the cancelled thread, which will lead to
problems like this later:

  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  0x00007f846b025be2 in detach_source (source=0x7f845f435f60) at ../spa/plugins/support/loop.c:144
  144      e->data = NULL;
  [Current thread is 1 (LWP 5274)]
  (gdb) p e
  $1 = (struct spa_poll_event *) 0x7f845e297820
  (gdb) bt
  #0  0x00007f846b025be2 in detach_source (source=0x7f845f435f60) at ../spa/plugins/support/loop.c:144
  #1  0x00007f846b0276ad in free_source (s=0x7f845f435f60) at ../spa/plugins/support/loop.c:359
  #2  0x00007f846b02a453 in loop_destroy_source (object=0x7f845f3af478, source=0x7f845f435f60) at ../spa/plugins/support/loop.c:786
  #3  0x00007f846b02a886 in impl_clear (handle=0x7f845f3af478) at ../spa/plugins/support/loop.c:859
  #4  0x00007f846b172f40 in unref_handle (handle=0x7f845f3af450) at ../src/pipewire/pipewire.c:211
  #5  0x00007f846b173579 in pw_unload_spa_handle (handle=0x7f845f3af478) at ../src/pipewire/pipewire.c:346
  #6  0x00007f846b15a761 in pw_loop_destroy (loop=0x7f845f434e30) at ../src/pipewire/loop.c:159
  #7  0x00007f846b135d8e in pw_data_loop_destroy (loop=0x7f845f434cb0) at ../src/pipewire/data-loop.c:166
  #8  0x00007f846b12c31c in pw_context_destroy (context=0x7f845f41c690) at ../src/pipewire/context.c:485
  #9  0x00007f846b3ddf9e in jack_client_close (client=0x7f845f3c1030) at ../pipewire-jack/src/pipewire-jack.c:3481
  ...
2022-06-02 00:24:24 +02:00
..
cpu-arm.c cpu: disable VFP asm when not available 2021-10-25 16:32:16 +02:00
cpu-x86.c cpu: only run SSE code when supported 2021-11-02 20:12:35 +01:00
cpu.c cpu: fix compilation on some architectures 2021-10-21 11:09:48 +02:00
dbus.c dbuf: use log topic 2021-10-03 12:27:20 +02:00
evl-plugin.c Add evl system support 2019-06-24 09:42:05 +02:00
evl-system.c treewide: replace strcmp() == 0 with spa_streq() 2021-05-18 22:10:27 +10:00
journal.c spa: support: do not include C source file 2021-09-29 15:07:36 +00:00
log-patterns.c json: spa_json_get_string() writes up to len chars or fail 2022-01-04 10:42:32 +01:00
log-patterns.h spa: support: do not include C source file 2021-09-29 15:07:36 +00:00
logger.c support: close log file when we opened it 2022-02-08 11:30:39 +01:00
loop.c spa: support: loop: handle cancellation better 2022-06-02 00:24:24 +02:00
meson.build treewide: meson.build: use feature.allowed() 2022-02-04 00:15:59 +01:00
node-driver.c spa: only remove embedded source from data loop from within the loop 2022-03-06 18:40:43 +00:00
null-audio-sink.c spa: only remove embedded source from data loop from within the loop 2022-03-06 18:40:43 +00:00
plugin.c support: add null audio sink 2020-08-20 18:00:00 +02:00
system.c spa: sprinkle more log topics into spa 2021-09-28 09:35:39 +02:00