diff options
author | Conor Curran <conor.curran@canonical.com> | 2012-03-14 11:57:48 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2012-03-14 11:57:48 +0000 |
commit | f61ca4cc7e620fe55b4d91f6a798abb3063fdcf2 (patch) | |
tree | d097e8f8149870ed19a366aaa2cb5e503f27b70b /src | |
parent | c759f4e9b00132c499241448d8c4f8eb72297d17 (diff) | |
download | ayatana-indicator-sound-f61ca4cc7e620fe55b4d91f6a798abb3063fdcf2.tar.gz ayatana-indicator-sound-f61ca4cc7e620fe55b4d91f6a798abb3063fdcf2.tar.bz2 ayatana-indicator-sound-f61ca4cc7e620fe55b4d91f6a798abb3063fdcf2.zip |
make sure to be defensive if pulse goes away in the middle of a global mute operation
Diffstat (limited to 'src')
-rw-r--r-- | src/pulseaudio-mgr.c | 28 |
1 files changed, 17 insertions, 11 deletions
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 |