summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorben <benjaminfranzke@googlemail.com>2010-07-23 02:15:41 +0200
committerben <benjaminfranzke@googlemail.com>2010-07-23 02:15:41 +0200
commit3f8f345e8b954ebc5e32df331a49e51445126fe2 (patch)
treedebd2c79ffe9108a4954358a6847e0fa19a6c3ec /src
parent7036e1cceba00b6a4912629f7678488daf678df3 (diff)
downloadpa-sink-ctl-3f8f345e8b954ebc5e32df331a49e51445126fe2.tar.gz
pa-sink-ctl-3f8f345e8b954ebc5e32df331a49e51445126fe2.tar.bz2
pa-sink-ctl-3f8f345e8b954ebc5e32df331a49e51445126fe2.zip
increase exit smoothness + add some g_asserts
Diffstat (limited to 'src')
-rw-r--r--src/pa-sink-ctl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c
index 41e1a9d..f44a42e 100644
--- a/src/pa-sink-ctl.c
+++ b/src/pa-sink-ctl.c
@@ -76,6 +76,7 @@ static int loop(gpointer data)
*/
void context_state_callback(pa_context *c, gpointer userdata)
{
+ static pa_operation *o = NULL;
switch (pa_context_get_state(c)) {
case PA_CONTEXT_CONNECTING:
status("connecting...");
@@ -91,7 +92,6 @@ void context_state_callback(pa_context *c, gpointer userdata)
collect_all_info();
g_timeout_add(3, loop, NULL);
pa_context_set_subscribe_callback(context, subscribe_cb, NULL);
- pa_operation *o;
g_assert((o = pa_context_subscribe(c, (pa_subscription_mask_t) (
PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SINK_INPUT
), NULL, NULL)));
@@ -102,6 +102,10 @@ void context_state_callback(pa_context *c, gpointer userdata)
break;
case PA_CONTEXT_TERMINATED:
+ g_assert(o != NULL);
+ pa_operation_cancel(o);
+ pa_operation_unref(o);
+ o = NULL;
status("connection terminated.");
g_main_loop_quit((GMainLoop *)userdata);
break;
@@ -116,6 +120,7 @@ void context_state_callback(pa_context *c, gpointer userdata)
*/
void get_sink_info_callback(pa_context *c, const pa_sink_info *i, gint is_last, gpointer userdata)
{
+ g_assert(userdata != NULL);
GArray *sink_list_tmp = userdata;
if (is_last < 0) {
@@ -145,6 +150,7 @@ void get_sink_info_callback(pa_context *c, const pa_sink_info *i, gint is_last,
*/
void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, gint is_last, gpointer userdata)
{
+ g_assert(userdata != NULL);
GArray *sink_list_tmp = userdata;
if (is_last < 0) {