diff options
author | Conor Curran <conor.curran@canonical.com> | 2012-03-14 18:55:22 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2012-03-14 18:55:22 +0000 |
commit | ca2d708b57218c16c505fc5092f4c0c3ea52f89c (patch) | |
tree | 73d1e4440772f8f5b5ef68f2e435ca4cb3ea22a3 /src | |
parent | c759f4e9b00132c499241448d8c4f8eb72297d17 (diff) | |
download | ayatana-indicator-sound-ca2d708b57218c16c505fc5092f4c0c3ea52f89c.tar.gz ayatana-indicator-sound-ca2d708b57218c16c505fc5092f4c0c3ea52f89c.tar.bz2 ayatana-indicator-sound-ca2d708b57218c16c505fc5092f4c0c3ea52f89c.zip |
make the code clear so as coverity stops whinging.
Diffstat (limited to 'src')
-rw-r--r-- | src/pulseaudio-mgr.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index fee504e..b8d754f 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -401,27 +401,39 @@ pm_context_state_callback (pa_context *c, void *userdata) case PA_CONTEXT_READY: connection_attempts = 0; g_debug("PA_CONTEXT_READY"); + if (reconnect_idle_id != 0){ g_source_remove (reconnect_idle_id); reconnect_idle_id = 0; } - pa_operation *o; pa_context_set_subscribe_callback(c, pm_subscribed_events_callback, userdata); - - if (!(o = pa_context_subscribe (c, (pa_subscription_mask_t) - (PA_SUBSCRIPTION_MASK_SINK| - PA_SUBSCRIPTION_MASK_SOURCE| - PA_SUBSCRIPTION_MASK_SINK_INPUT| - PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| - PA_SUBSCRIPTION_MASK_SERVER), NULL, NULL))) { - g_warning("pa_context_subscribe() failed"); + pa_operation *o = NULL; + + o = pa_context_subscribe (c, (pa_subscription_mask_t) + (PA_SUBSCRIPTION_MASK_SINK| + PA_SUBSCRIPTION_MASK_SOURCE| + PA_SUBSCRIPTION_MASK_SINK_INPUT| + PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| + PA_SUBSCRIPTION_MASK_SERVER), + NULL, + NULL); + + if (!o){ + g_critical("pa_context_subscribe() failed - ?"); + return; } - if (!(o = pa_context_get_server_info (c, pm_server_info_callback, userdata))) { - g_warning("Initial - pa_context_get_server_info() failed"); + pa_operation_unref(o); + + o = pa_context_get_server_info (c, pm_server_info_callback, userdata); + + if (!o){ + g_warning("pa_context_get_server_info() failed - ?"); + return; } + pa_operation_unref(o); break; |