aboutsummaryrefslogtreecommitdiff
path: root/src/pulseaudio-mgr.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-02-28 12:45:19 +0000
committerConor Curran <conor.curran@canonical.com>2011-02-28 12:45:19 +0000
commit8ec8d6d2abc55ddc140fc5d390ba2034b1fa6588 (patch)
treed023e0db28a21d330604132293a50f513307a06c /src/pulseaudio-mgr.c
parent34f506610a83ae6f3570389268fa332f51c455a5 (diff)
downloadayatana-indicator-sound-8ec8d6d2abc55ddc140fc5d390ba2034b1fa6588.tar.gz
ayatana-indicator-sound-8ec8d6d2abc55ddc140fc5d390ba2034b1fa6588.tar.bz2
ayatana-indicator-sound-8ec8d6d2abc55ddc140fc5d390ba2034b1fa6588.zip
caught a edge case bug which was causing those weird crashes
Diffstat (limited to 'src/pulseaudio-mgr.c')
-rw-r--r--src/pulseaudio-mgr.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c
index 76102e4..a0199ea 100644
--- a/src/pulseaudio-mgr.c
+++ b/src/pulseaudio-mgr.c
@@ -220,11 +220,12 @@ pm_subscribed_events_callback (pa_context *c,
}
break;
case PA_SUBSCRIPTION_EVENT_SOURCE:
- g_debug ("Looks like source event of some description");
+ g_debug ("Looks like source event of some description - index = %i", index);
// We don't care about any other sink other than the active one.
if (index != active_sink_get_source_index (sink))
return;
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
+ g_debug ("Source removal event - index = %i", index);
active_sink_deactivate_voip_source (sink, FALSE);
}
else{
@@ -396,8 +397,8 @@ pm_sink_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
+ g_warning ("sink info callback - our user data is not what we think it should be or the sink parameter is null");
return;
}
ActiveSink* a_sink = ACTIVE_SINK (userdata);
@@ -418,8 +419,8 @@ pm_default_sink_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("Default sink info callback - our user data is not what we think it should be or the info parameter is null");
return;
}
// Only repopulate if there is a change with regards the index
@@ -441,9 +442,8 @@ pm_sink_input_info_callback (pa_context *c,
return;
}
else {
- if (info == NULL) {
- // TODO: watch this carefully - PA async api should not be doing this . . .
- g_warning("\n Sink input info callback : SINK INPUT INFO IS NULL BUT EOL was not POSITIVE!!!");
+ if (info == NULL || IS_ACTIVE_SINK (userdata) == FALSE) {
+ g_warning("Sink input info callback : SINK INPUT INFO IS NULL or our user_data is not what we think it should be");
return;
}
@@ -486,8 +486,8 @@ pm_update_active_sink (pa_context *c,
return;
}
else{
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("update_active_sink - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("update_active_sink - our user data is not what we think it should be or the info parameter is null");
return;
}
active_sink_update (ACTIVE_SINK(userdata), info);
@@ -504,6 +504,11 @@ pm_toggle_mute_for_every_sink_callback (pa_context *c,
return;
}
else {
+ if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
+ g_warning ("toggle_mute cb - our user data is not what we think it should be or the sink parameter is null");
+ return;
+ }
+
pa_operation_unref (pa_context_set_sink_mute_by_index (c,
sink->index,
GPOINTER_TO_INT(userdata),
@@ -523,8 +528,8 @@ pm_default_source_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("Default source info callback - our user data is not what we think it should be or the source info parameter is null");
return;
}
// If there is an index change we need to change our cached source
@@ -546,8 +551,8 @@ pm_source_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("source info callback - our user data is not what we think it should be or the source info parameter is null");
return;
}
// For now we will take the first available
@@ -567,8 +572,8 @@ pm_update_source_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL ){
+ g_warning ("source info update callback - our user data is not what we think it should be or the source info paramter is null");
return;
}
g_debug ("Got a source update for %s , index %i", info->name, info->index);