Sources should probably be added to pa_core.sources in pa_source_put(),
but currently they're added in pa_source_new(). A lot of stuff can
happen between the pa_source_new() and pa_source_put() calls, and
it has happened that the default source was updated during this time.
Therefore, pa_core_update_default_source() needs to take it into account
that not every source is necessarily linked.
pa_assert(core);
PA_IDXSET_FOREACH(sink, core->sinks, idx) {
+ if (!PA_SINK_IS_LINKED(sink->state))
+ continue;
+
if (!best) {
best = sink;
continue;
pa_assert(core);
PA_IDXSET_FOREACH(source, core->sources, idx) {
+ if (!PA_SOURCE_IS_LINKED(source->state))
+ continue;
+
if (!best) {
best = source;
continue;