summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-07-20 17:42:14 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-07-20 17:47:51 +0900
commit5db3e557c5614d97f8c6089158f117cce8b85254 (patch)
treecdb09d248d0ff57fd262866f21a76d74030cfd58
parent7bb14727afc115baa4ab5145ebbee4b1f1eaeb44 (diff)
downloadefl-5db3e557c5614d97f8c6089158f117cce8b85254.tar.gz
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).
-rw-r--r--src/lib/eina/eina_list.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c
index 979e484aa4..72dc8134bf 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;