From: Jean-Philippe Andre Date: Thu, 20 Jul 2017 08:42:14 +0000 (+0900) Subject: eina_list: Ensure single init X-Git-Tag: upstream/1.20.0~183 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5db3e557c5614d97f8c6089158f117cce8b85254;p=platform%2Fupstream%2Fefl.git eina_list: Ensure single init This fixes a crash in make check when --profile=dev is explicitely enabled. eina_list_init() is called by the standard eina_init() loop and by eina_debug_init() as well. Honestly I'm not sure why it doesn't crash for other people as well... The crash was in eolian_suite during the second eina_init (called from eolian_init). --- diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c index 979e484..72dc813 100644 --- a/src/lib/eina/eina_list.c +++ b/src/lib/eina/eina_list.c @@ -473,6 +473,8 @@ eina_list_sort_merge(Eina_List *a, Eina_List *b, Eina_Compare_Cb func) * Global * *============================================================================*/ +static int _eina_list_init = 0; + /** * @internal * @brief Initialize the list module. @@ -493,6 +495,9 @@ eina_list_init(void) { const char *choice, *tmp; + if ((_eina_list_init++) > 0) + return _eina_list_init; + _eina_list_log_dom = eina_log_domain_register("eina_list", EINA_LOG_COLOR_DEFAULT); if (_eina_list_log_dom < 0) @@ -557,9 +562,17 @@ on_init_fail: Eina_Bool eina_list_shutdown(void) { + if ((--_eina_list_init) != 0) + { + if (_eina_list_init < 0) _eina_list_init = 0; + return _eina_list_init; + } + eina_freeq_clear(eina_freeq_main_get()); eina_mempool_del(_eina_list_accounting_mp); eina_mempool_del(_eina_list_mp); + _eina_list_accounting_mp = NULL; + _eina_list_mp = NULL; eina_log_domain_unregister(_eina_list_log_dom); _eina_list_log_dom = -1;