jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5db3e557c5614d97f8c6089158f117cce8b85254

commit 5db3e557c5614d97f8c6089158f117cce8b85254
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Jul 20 17:42:14 2017 +0900

    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).
---
 src/lib/eina/eina_list.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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;

-- 


Reply via email to