]> code.delx.au - pulseaudio/commitdiff
protocol-native: Don't enumerate unlinked sinks and sources
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Sun, 8 Dec 2013 22:18:00 +0000 (14:18 -0800)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Fri, 14 Feb 2014 16:06:21 +0000 (21:36 +0530)
This makes sure that there is no window between pa_sink/source_new()
and _put() where enumerating sinks/sources causes an assert (several
calls in sink/source_get_info need a linked sink or source).

src/pulsecore/protocol-native.c

index 41b4b505a2233245afb9f4b6442bfb8a4f0847d1..80e72a894a11713f73740382f0c85d35e8ecd148 100644 (file)
@@ -3588,11 +3588,13 @@ static void command_get_info_list(pa_pdispatch *pd, uint32_t command, uint32_t t
 
     if (i) {
         PA_IDXSET_FOREACH(p, i, idx) {
-            if (command == PA_COMMAND_GET_SINK_INFO_LIST)
-                sink_fill_tagstruct(c, reply, p);
-            else if (command == PA_COMMAND_GET_SOURCE_INFO_LIST)
-                source_fill_tagstruct(c, reply, p);
-            else if (command == PA_COMMAND_GET_CLIENT_INFO_LIST)
+            if (command == PA_COMMAND_GET_SINK_INFO_LIST) {
+                if (PA_SINK_IS_LINKED(((pa_sink *)p)->state))
+                    sink_fill_tagstruct(c, reply, p);
+            } else if (command == PA_COMMAND_GET_SOURCE_INFO_LIST) {
+                if (PA_SOURCE_IS_LINKED(((pa_source *)p)->state))
+                    source_fill_tagstruct(c, reply, p);
+            } else if (command == PA_COMMAND_GET_CLIENT_INFO_LIST)
                 client_fill_tagstruct(c, reply, p);
             else if (command == PA_COMMAND_GET_CARD_INFO_LIST)
                 card_fill_tagstruct(c, reply, p);