]> code.delx.au - pulseaudio/blobdiff - src/modules/module-stream-restore.c
modules: add various checks to avoid selecting objects that are not linked or in...
[pulseaudio] / src / modules / module-stream-restore.c
index 727a52752fb5b78513a9829305b5a9f8ee5189a3..e560bd2805594137e1ec0724c7e3996f7faf24d7 100644 (file)
@@ -540,6 +540,11 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, struct
         if (si->save_sink)
             continue;
 
+        /* Skip this if it is already in the process of being moved
+         * anyway */
+        if (!si->sink)
+            continue;
+
         /* It might happen that a stream and a sink are set up at the
            same time, in which case we want to make sure we don't
            interfere with that */
@@ -584,6 +589,10 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source,
         if (so->direct_on_input)
             continue;
 
+        /* Skip this if it is already in the process of being moved anyway */
+        if (!so->source)
+            continue;
+
         /* It might happen that a stream and a sink are set up at the
            same time, in which case we want to make sure we don't
            interfere with that */
@@ -623,6 +632,9 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str
         char *name;
         struct entry *e;
 
+        if (!si->sink)
+            continue;
+
         if (!(name = get_name(si->proplist, "sink-input")))
             continue;
 
@@ -663,6 +675,12 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc
         char *name;
         struct entry *e;
 
+        if (so->direct_on_input)
+            continue;
+
+        if (!so->source)
+            continue;
+
         if (!(name = get_name(so->proplist, "source-output")))
             continue;