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
1=== modified file 'src/pulseaudio-mgr.c'
2--- src/pulseaudio-mgr.c 2011-02-18 16:56:17 +0000
3+++ src/pulseaudio-mgr.c 2011-02-28 12:52:03 +0000
4@@ -220,11 +220,12 @@
5 }
6 break;
7 case PA_SUBSCRIPTION_EVENT_SOURCE:
8- g_debug ("Looks like source event of some description");
9+ g_debug ("Looks like source event of some description - index = %i", index);
10 // We don't care about any other sink other than the active one.
11 if (index != active_sink_get_source_index (sink))
12 return;
13 if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
14+ g_debug ("Source removal event - index = %i", index);
15 active_sink_deactivate_voip_source (sink, FALSE);
16 }
17 else{
18@@ -396,8 +397,8 @@
19 return;
20 }
21 else {
22- if (IS_ACTIVE_SINK (userdata) == FALSE){
23- g_warning ("sink info callback - our user data is not what we think it should be");
24+ if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
25+ g_warning ("sink info callback - our user data is not what we think it should be or the sink parameter is null");
26 return;
27 }
28 ActiveSink* a_sink = ACTIVE_SINK (userdata);
29@@ -418,8 +419,8 @@
30 return;
31 }
32 else {
33- if (IS_ACTIVE_SINK (userdata) == FALSE){
34- g_warning ("Default sink info callback - our user data is not what we think it should be");
35+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
36+ g_warning ("Default sink info callback - our user data is not what we think it should be or the info parameter is null");
37 return;
38 }
39 // Only repopulate if there is a change with regards the index
40@@ -441,9 +442,8 @@
41 return;
42 }
43 else {
44- if (info == NULL) {
45- // TODO: watch this carefully - PA async api should not be doing this . . .
46- g_warning("\n Sink input info callback : SINK INPUT INFO IS NULL BUT EOL was not POSITIVE!!!");
47+ if (info == NULL || IS_ACTIVE_SINK (userdata) == FALSE) {
48+ g_warning("Sink input info callback : SINK INPUT INFO IS NULL or our user_data is not what we think it should be");
49 return;
50 }
51
52@@ -486,8 +486,8 @@
53 return;
54 }
55 else{
56- if (IS_ACTIVE_SINK (userdata) == FALSE){
57- g_warning ("update_active_sink - our user data is not what we think it should be");
58+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
59+ g_warning ("update_active_sink - our user data is not what we think it should be or the info parameter is null");
60 return;
61 }
62 active_sink_update (ACTIVE_SINK(userdata), info);
63@@ -504,6 +504,11 @@
64 return;
65 }
66 else {
67+ if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
68+ g_warning ("toggle_mute cb - our user data is not what we think it should be or the sink parameter is null");
69+ return;
70+ }
71+
72 pa_operation_unref (pa_context_set_sink_mute_by_index (c,
73 sink->index,
74 GPOINTER_TO_INT(userdata),
75@@ -523,8 +528,8 @@
76 return;
77 }
78 else {
79- if (IS_ACTIVE_SINK (userdata) == FALSE){
80- g_warning ("Default sink info callback - our user data is not what we think it should be");
81+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
82+ g_warning ("Default source info callback - our user data is not what we think it should be or the source info parameter is null");
83 return;
84 }
85 // If there is an index change we need to change our cached source
86@@ -546,8 +551,8 @@
87 return;
88 }
89 else {
90- if (IS_ACTIVE_SINK (userdata) == FALSE){
91- g_warning ("Default sink info callback - our user data is not what we think it should be");
92+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
93+ g_warning ("source info callback - our user data is not what we think it should be or the source info parameter is null");
94 return;
95 }
96 // For now we will take the first available
97@@ -567,8 +572,8 @@
98 return;
99 }
100 else {
101- if (IS_ACTIVE_SINK (userdata) == FALSE){
102- g_warning ("Default sink info callback - our user data is not what we think it should be");
103+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL ){
104+ g_warning ("source info update callback - our user data is not what we think it should be or the source info paramter is null");
105 return;
106 }
107 g_debug ("Got a source update for %s , index %i", info->name, info->index);

Subscribers

People subscribed via source and target branches