diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-03-14 15:04:10 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-03-14 15:04:10 -0500 |
commit | 6d53111b169442dc56f1fdeddea809326b8f2740 (patch) | |
tree | fc3b443349a6a1bbd06d18dcdd947bbe2993213a | |
parent | 29e476ae9f9711fdd67197eb997923651fea563c (diff) | |
parent | f61ca4cc7e620fe55b4d91f6a798abb3063fdcf2 (diff) | |
download | ayatana-indicator-sound-6d53111b169442dc56f1fdeddea809326b8f2740.tar.gz ayatana-indicator-sound-6d53111b169442dc56f1fdeddea809326b8f2740.tar.bz2 ayatana-indicator-sound-6d53111b169442dc56f1fdeddea809326b8f2740.zip |
fix pa_operation_unref(NULL) crash by merging ~cjcurran/indicator-sound/global-mute-defensive
-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 b8d754f..f205723 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); } @@ -633,17 +633,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 |