nixpkgs/pkgs/applications/networking/browsers/firefox/fix-pa-context-connect-retval.patch
Jan Malakhovski 23e2ea9cba firefoxPackages: add a patch to fix pulseaudio initialization bug
This is optional (`libcardiacarrest` has a workaround for this bug
because there's `firefox-bin` that I can't fix), but with this applied things
are a bit smoother.
2018-03-09 21:21:06 +00:00

27 lines
897 B
Diff

Yep, it's a "return code was ignored" bug.
diff --git a/media/libcubeb/src/cubeb_pulse.c b/media/libcubeb/src/cubeb_pulse.c
index aaaaaaaaaaa..bbbbbbbbbbb 100644
--- a/media/libcubeb/src/cubeb_pulse.c
+++ b/media/libcubeb/src/cubeb_pulse.c
@@ -473,6 +473,8 @@
static int
pulse_context_init(cubeb * ctx)
{
+ int r;
+
if (ctx->context) {
assert(ctx->error == 1);
pulse_context_destroy(ctx);
@@ -486,9 +488,9 @@
WRAP(pa_context_set_state_callback)(ctx->context, context_state_callback, ctx);
WRAP(pa_threaded_mainloop_lock)(ctx->mainloop);
- WRAP(pa_context_connect)(ctx->context, NULL, 0, NULL);
+ r = WRAP(pa_context_connect)(ctx->context, NULL, 0, NULL);
- if (wait_until_context_ready(ctx) != 0) {
+ if (r < 0 || wait_until_context_ready(ctx) != 0) {
WRAP(pa_threaded_mainloop_unlock)(ctx->mainloop);
pulse_context_destroy(ctx);
ctx->context = NULL;