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.
This commit is contained in:
Marcel Hollerbach 2016-03-19 15:52:32 +01:00 committed by Mike Blumenkrantz
parent 1db14b547a
commit 61182d6434
1 changed files with 4 additions and 1 deletions

View File

@ -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;