From f61ca4cc7e620fe55b4d91f6a798abb3063fdcf2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 14 Mar 2012 11:57:48 +0000 Subject: make sure to be defensive if pulse goes away in the middle of a global mute operation --- src/pulseaudio-mgr.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/pulseaudio-mgr.c') diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index fee504e..747f59b 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -218,7 +218,7 @@ pm_update_mute (gboolean update) if (!operation){ g_warning ("pm_update_mute operation failed for some reason"); return; - } + } pa_operation_unref (operation); } @@ -621,17 +621,23 @@ pm_toggle_mute_for_every_sink_callback (pa_context *c, if (eol > 0) { return; } - else { - if (sink == NULL) { - g_warning ("toggle_mute cb - sink parameter is null - why ?"); - return; - } - pa_operation_unref (pa_context_set_sink_mute_by_index (c, - sink->index, - GPOINTER_TO_INT(userdata), - NULL, - NULL)); + + if (sink == NULL) { + g_warning ("toggle_mute cb - sink parameter is null - why ?"); + return; } + + pa_operation *operation = NULL; + operation = pa_context_set_sink_mute_by_index (c, + sink->index, + GPOINTER_TO_INT(userdata), + NULL, + NULL); + if (!operation){ + g_warning ("pm_update_mic_mute operation failed for some reason"); + return; + } + pa_operation_unref (operation); } // Source info related callbacks -- cgit v1.2.3