]> code.delx.au - pulseaudio/commitdiff
sink-input,source-output: Handle devices going away in unlink hooks
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 9 Feb 2012 11:20:31 +0000 (16:50 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 9 Feb 2012 11:25:48 +0000 (16:55 +0530)
If a *_UNLINK_POST hook causes a sink-input/source-output's sink/source
to go away, the subsequent attempt to update the sink/source status will
cause an assert. We deal with this by checking the sink/source status
before trying to update it.

src/pulsecore/sink-input.c
src/pulsecore/source-output.c

index 93caa8fa871a36802beb351f20c30b13895bf93f..7f824fa55e5d9337863d8ffb1fe455415183f251 100644 (file)
@@ -657,7 +657,9 @@ void pa_sink_input_unlink(pa_sink_input *i) {
     }
 
     if (i->sink) {
-        pa_sink_update_status(i->sink);
+        if (PA_SINK_IS_LINKED(pa_sink_get_state(i->sink)))
+            pa_sink_update_status(i->sink);
+
         i->sink = NULL;
     }
 
index 8a35ab0f79ff17ec26210146e6e63e400f8e3775..2f38af577a5501f4a96c17792d52484c3c8cc338 100644 (file)
@@ -587,7 +587,9 @@ void pa_source_output_unlink(pa_source_output*o) {
     }
 
     if (o->source) {
-        pa_source_update_status(o->source);
+        if (PA_SOURCE_IS_LINKED(pa_source_get_state(o->source)))
+            pa_source_update_status(o->source);
+
         o->source = NULL;
     }