From f174008a8374daab0fc4355f804e0b342280aeb4 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Fri, 18 Dec 2015 13:15:25 +0100 Subject: [PATCH] mixer: only save state if not in init If we are calling emix_config_save_state_get while in init, we are freeing the list emix_config_save_state_restore is iterating over. This leads to crashes. @fix T2942 @fix T2906 --- src/modules/mixer/e_mod_main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index d907a0940..8dcdaf8f1 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -7,6 +7,7 @@ #define VOLUME_STEP 5 int _e_emix_log_domain; +static Eina_Bool init; /* module requirements */ E_API E_Module_Api e_modapi = @@ -650,7 +651,6 @@ _sink_event(int type, void *info) mixer_context->sink_default = l->data; else mixer_context->sink_default = NULL; - emix_config_save_state_get(); if (emix_config_save_get()) e_config_save_queue(); _mixer_gadget_update(); } @@ -667,8 +667,17 @@ _sink_event(int type, void *info) { DBG("Sink added"); } - emix_config_save_state_get(); - if (emix_config_save_get()) e_config_save_queue(); + /* + Only safe the state if we are not in init mode, + If we are in init mode, this is a result of the restore call. + Restore iterates over a list of sinks which would get deleted in the + save_state_get call. + */ + if (!init) + { + emix_config_save_state_get(); + if (emix_config_save_get()) e_config_save_queue(); + } } static void @@ -678,9 +687,11 @@ _disconnected(void) _mixer_gadget_update(); } + static void _ready(void) { + init = EINA_TRUE; if (emix_sink_default_support()) mixer_context->sink_default = emix_sink_default_get(); else @@ -713,6 +724,7 @@ _ready(void) } _mixer_gadget_update(); + init = EINA_FALSE; } static void