diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-08-21 15:36:03 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-08-21 15:36:03 +0200 |
commit | 4370675d2bc54fecbd54e5d618644dca0f87aa41 (patch) | |
tree | c0734555066ec53120fbc40e26b022a31c5dea01 /pipewire-pulseaudio | |
parent | f3c06372ef5dabb63e4b550a1bf60b629c085cbd (diff) |
pulse: fix crash when cleaning up signals
Also make sure the main pulseaudio binary can't be started.
Diffstat (limited to 'pipewire-pulseaudio')
-rw-r--r-- | pipewire-pulseaudio/src/mainloop-signal.c | 16 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/mainloop.c | 3 | ||||
-rw-r--r-- | pipewire-pulseaudio/src/version.c | 1 |
3 files changed, 12 insertions, 8 deletions
diff --git a/pipewire-pulseaudio/src/mainloop-signal.c b/pipewire-pulseaudio/src/mainloop-signal.c index 5caf5920..19fe3122 100644 --- a/pipewire-pulseaudio/src/mainloop-signal.c +++ b/pipewire-pulseaudio/src/mainloop-signal.c @@ -31,6 +31,7 @@ static pa_mainloop_api *api = NULL; +static bool have_signals = false; static struct spa_list signals; static struct pw_loop *loop = NULL; @@ -58,14 +59,12 @@ int pa_signal_init(pa_mainloop_api *a) SPA_EXPORT void pa_signal_done(void) { - pa_signal_event *ev, *t; - - pa_assert(api); - - spa_list_for_each_safe(ev, t, &signals, link) - pa_signal_free(ev); - spa_list_init(&signals); + pa_signal_event *ev; + if (have_signals) { + spa_list_consume(ev, &signals, link) + pa_signal_free(ev); + } api = NULL; } @@ -89,6 +88,9 @@ pa_signal_event* pa_signal_new(int sig, pa_signal_cb_t callback, void *userdata) ev->callback = callback; ev->userdata = userdata; + if (!have_signals) + spa_list_init(&signals); + have_signals = true; spa_list_append(&signals, &ev->link); return ev; diff --git a/pipewire-pulseaudio/src/mainloop.c b/pipewire-pulseaudio/src/mainloop.c index 9170b49e..2ff97f74 100644 --- a/pipewire-pulseaudio/src/mainloop.c +++ b/pipewire-pulseaudio/src/mainloop.c @@ -254,6 +254,9 @@ pa_mainloop *pa_mainloop_new(void) { pa_mainloop *loop; + if (getenv("PULSE_INTERNAL")) + return NULL; + loop = calloc(1, sizeof(pa_mainloop)); if (loop == NULL) return NULL; diff --git a/pipewire-pulseaudio/src/version.c b/pipewire-pulseaudio/src/version.c index 06c63c37..69e269c2 100644 --- a/pipewire-pulseaudio/src/version.c +++ b/pipewire-pulseaudio/src/version.c @@ -32,4 +32,3 @@ bool pa_is_pipewire(void) { return true; } - |