Merge lp:~cjcurran/indicator-sound/pulse-proper-error-handling into lp:~indicator-applet-developers/indicator-sound/trunk_3

Proposed by Conor Curran
Status: Merged
Merged at revision: 206
Proposed branch: lp:~cjcurran/indicator-sound/pulse-proper-error-handling
Merge into: lp:~indicator-applet-developers/indicator-sound/trunk_3
Diff against target: 107 lines (+21/-16)
1 file modified
src/pulseaudio-mgr.c (+21/-16)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/pulse-proper-error-handling
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+51530@code.launchpad.net

Description of the change

I wasn't properly handling an edge case concerning pulse server callback communication whereby the eol is not positive (i.e. its not the end of a sequence of callbacks) but the pulse pointer is null. According to the docs this reflects some sort of error. It can be seen to be triggered when you remove a sound device (usb headset or whatever) while a Voip app is open. Fixes the bug attached and I suspect some of the other weird crashes reported in recent weeks.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/pulseaudio-mgr.c'
--- src/pulseaudio-mgr.c 2011-02-18 16:56:17 +0000
+++ src/pulseaudio-mgr.c 2011-02-28 12:52:03 +0000
@@ -220,11 +220,12 @@
220 }220 }
221 break;221 break;
222 case PA_SUBSCRIPTION_EVENT_SOURCE:222 case PA_SUBSCRIPTION_EVENT_SOURCE:
223 g_debug ("Looks like source event of some description");223 g_debug ("Looks like source event of some description - index = %i", index);
224 // We don't care about any other sink other than the active one.224 // We don't care about any other sink other than the active one.
225 if (index != active_sink_get_source_index (sink))225 if (index != active_sink_get_source_index (sink))
226 return;226 return;
227 if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {227 if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
228 g_debug ("Source removal event - index = %i", index);
228 active_sink_deactivate_voip_source (sink, FALSE);229 active_sink_deactivate_voip_source (sink, FALSE);
229 }230 }
230 else{231 else{
@@ -396,8 +397,8 @@
396 return;397 return;
397 }398 }
398 else {399 else {
399 if (IS_ACTIVE_SINK (userdata) == FALSE){400 if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
400 g_warning ("sink info callback - our user data is not what we think it should be");401 g_warning ("sink info callback - our user data is not what we think it should be or the sink parameter is null");
401 return;402 return;
402 }403 }
403 ActiveSink* a_sink = ACTIVE_SINK (userdata);404 ActiveSink* a_sink = ACTIVE_SINK (userdata);
@@ -418,8 +419,8 @@
418 return;419 return;
419 } 420 }
420 else {421 else {
421 if (IS_ACTIVE_SINK (userdata) == FALSE){422 if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
422 g_warning ("Default sink info callback - our user data is not what we think it should be");423 g_warning ("Default sink info callback - our user data is not what we think it should be or the info parameter is null");
423 return;424 return;
424 }425 }
425 // Only repopulate if there is a change with regards the index426 // Only repopulate if there is a change with regards the index
@@ -441,9 +442,8 @@
441 return;442 return;
442 }443 }
443 else {444 else {
444 if (info == NULL) {445 if (info == NULL || IS_ACTIVE_SINK (userdata) == FALSE) {
445 // TODO: watch this carefully - PA async api should not be doing this . . .446 g_warning("Sink input info callback : SINK INPUT INFO IS NULL or our user_data is not what we think it should be");
446 g_warning("\n Sink input info callback : SINK INPUT INFO IS NULL BUT EOL was not POSITIVE!!!");
447 return;447 return;
448 }448 }
449449
@@ -486,8 +486,8 @@
486 return;486 return;
487 }487 }
488 else{488 else{
489 if (IS_ACTIVE_SINK (userdata) == FALSE){489 if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
490 g_warning ("update_active_sink - our user data is not what we think it should be");490 g_warning ("update_active_sink - our user data is not what we think it should be or the info parameter is null");
491 return;491 return;
492 }492 }
493 active_sink_update (ACTIVE_SINK(userdata), info);493 active_sink_update (ACTIVE_SINK(userdata), info);
@@ -504,6 +504,11 @@
504 return;504 return;
505 }505 }
506 else {506 else {
507 if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
508 g_warning ("toggle_mute cb - our user data is not what we think it should be or the sink parameter is null");
509 return;
510 }
511
507 pa_operation_unref (pa_context_set_sink_mute_by_index (c,512 pa_operation_unref (pa_context_set_sink_mute_by_index (c,
508 sink->index,513 sink->index,
509 GPOINTER_TO_INT(userdata),514 GPOINTER_TO_INT(userdata),
@@ -523,8 +528,8 @@
523 return;528 return;
524 }529 }
525 else {530 else {
526 if (IS_ACTIVE_SINK (userdata) == FALSE){531 if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
527 g_warning ("Default sink info callback - our user data is not what we think it should be");532 g_warning ("Default source info callback - our user data is not what we think it should be or the source info parameter is null");
528 return;533 return;
529 }534 }
530 // If there is an index change we need to change our cached source535 // If there is an index change we need to change our cached source
@@ -546,8 +551,8 @@
546 return;551 return;
547 }552 }
548 else {553 else {
549 if (IS_ACTIVE_SINK (userdata) == FALSE){554 if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
550 g_warning ("Default sink info callback - our user data is not what we think it should be");555 g_warning ("source info callback - our user data is not what we think it should be or the source info parameter is null");
551 return;556 return;
552 }557 }
553 // For now we will take the first available558 // For now we will take the first available
@@ -567,8 +572,8 @@
567 return;572 return;
568 }573 }
569 else {574 else {
570 if (IS_ACTIVE_SINK (userdata) == FALSE){575 if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL ){
571 g_warning ("Default sink info callback - our user data is not what we think it should be");576 g_warning ("source info update callback - our user data is not what we think it should be or the source info paramter is null");
572 return;577 return;
573 }578 }
574 g_debug ("Got a source update for %s , index %i", info->name, info->index);579 g_debug ("Got a source update for %s , index %i", info->name, info->index);

Subscribers

People subscribed via source and target branches