From a841544d032b6e0aaec8898b279cc87d7b5436d8 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 16 Jan 2019 11:31:41 +0000 Subject: [PATCH] e client mixer handling - fix segv where inputs/sink cause segvs so i've been seeing this thing where inputs are deleted and then the sink is appropriately deleted from clients but not all the client windows it could have been on. the problem seems to manifest if multiple windows come from the same app playing audio so the sink may be assigned to only 1 window not all of them. this seems to nuke the segv as the sink/input was being left dangling on a window due to the logic in the add/del handling to give up when it finds the first window target and not all of them. so after a day or so of testing my segv's are gone. yay! @fix. --- src/modules/mixer/e_mod_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index 1798dd3b6..fa0397505 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -925,7 +925,7 @@ _get_ppid(pid_t pid) static void _sink_input_event(int type, Emix_Sink_Input *input) { - Eina_List *clients, *l; + Eina_List *clients, *l, *ll; E_Client *ec; E_Client_Volume_Sink *sink; pid_t pid; @@ -934,9 +934,9 @@ _sink_input_event(int type, Emix_Sink_Input *input) { case EMIX_SINK_INPUT_ADDED_EVENT: pid = input->pid; - while (42) + if ((pid <= 1) || (pid == getpid())) return; + else { - if (pid <= 1 || pid == getpid()) return; clients = e_client_focus_stack_get(); EINA_LIST_FOREACH(clients, l, ec) { @@ -952,20 +952,18 @@ _sink_input_event(int type, Emix_Sink_Input *input) input); e_client_volume_sink_append(ec, sink); _client_sinks = eina_list_append(_client_sinks, sink); - return; } } pid = _get_ppid(pid); } break; case EMIX_SINK_INPUT_REMOVED_EVENT: - EINA_LIST_FOREACH(_client_sinks, l, sink) + EINA_LIST_FOREACH_SAFE(_client_sinks, l, ll, sink) { if (sink->data == input) { e_client_volume_sink_del(sink); _client_sinks = eina_list_remove_list(_client_sinks, l); - break; } } break;