pipewire/test
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
..
meson.build test: add simple functional tests 2022-03-05 17:51:22 +00:00
pwtest-compat.c treewide: only define feature macros when the feature is available 2022-02-04 00:15:59 +01:00
pwtest-implementation.h treewide: retain sections to prevent linker garbage collection 2022-04-15 23:58:05 +02:00
pwtest.c SPA_DATA_DIR is the source root when uninstalled 2022-03-18 21:33:02 +01:00
pwtest.h treewide: retain sections to prevent linker garbage collection 2022-04-15 23:58:05 +02:00
test-array.c array: re-initialize the array in pw_array_clear() 2021-10-07 15:08:57 +10:00
test-client.c test: move the client and utils tests over here 2021-08-04 07:45:06 +00:00
test-config.c test: disable broken test 2022-02-01 18:15:16 +01:00
test-context.c treewide: only define feature macros when the feature is available 2022-02-04 00:15:59 +01:00
test-example.c meson.build: drop HAVE_CONFIG_H 2021-06-10 09:04:16 +10:00
test-functional.c test: add simple functional tests 2022-03-05 17:51:22 +00:00
test-lib.c pipewire: improve pw_init/pw_deinit 2022-03-26 21:20:07 +01:00
test-logger.c test: test-logger: ignore some systemd journal error codes 2021-12-01 11:13:50 +01:00
test-loop.c spa: support: loop: handle cancellation better 2022-06-02 00:24:24 +02:00
test-map.c map: make _insert_at() fail on a removed item 2021-10-25 16:17:35 +02:00
test-properties.c test: move some of the property tests to pwtest 2021-06-17 07:08:53 +00:00
test-pwtest.c treewide: only define feature macros when the feature is available 2022-02-04 00:15:59 +01:00
test-spa-buffer.c test: convert two spa tests to pwtest 2021-06-09 18:00:39 +10:00
test-spa-json.c json: improve unicode parsing 2022-04-27 08:37:32 +02:00
test-spa-log.c tests: fix log test 2021-09-29 17:06:35 +02:00
test-spa-node.c test: replace all spa_assert() macros with spa_assert_se() 2021-07-27 10:24:44 +10:00
test-spa-pod.c spa: Improve PropInfo fields 2022-03-30 17:09:08 +02:00
test-spa-utils.c spa: add a macro to check for a callback version 2021-09-28 09:35:38 +02:00
test-support.c test: add a test for the logger truncation 2021-06-09 18:00:39 +10:00
test-utils.c test: move the client and utils tests over here 2021-08-04 07:45:06 +00:00