From 61182d64347666f942c82e2574f9fc4c8cb45dea Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Sat, 19 Mar 2016 15:52:32 +0100 Subject: [PATCH] mixer: try to fix a possible bug for the case the default sink was removed the gadget will get a new default sink again, for the case of pa there is the possibility that at this time the sink is still the default one, but the sink gets removed. so we better set the default index to -1 and return just some sink for the case the default is deleted. --- src/modules/mixer/lib/backends/pulseaudio/pulse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/mixer/lib/backends/pulseaudio/pulse.c b/src/modules/mixer/lib/backends/pulseaudio/pulse.c index f88273477..c6b8bfa50 100644 --- a/src/modules/mixer/lib/backends/pulseaudio/pulse.c +++ b/src/modules/mixer/lib/backends/pulseaudio/pulse.c @@ -251,6 +251,9 @@ _sink_remove_cb(int index, void *data EINA_UNUSED) Eina_List *l; DBG("Removing sink: %d", index); + if (index == ctx->default_sink) + ctx->default_sink = -1; + EINA_LIST_FOREACH(ctx->sinks, l, sink) { if (sink->idx == index) @@ -1019,7 +1022,7 @@ _sink_default_get(void) EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL); EINA_LIST_FOREACH(ctx->sinks, l, s) - if (s->idx == ctx->default_sink) + if (s->idx == ctx->default_sink || ctx->default_sink == -1) return (Emix_Sink *)s; return NULL;