hermet pushed a commit to branch master.

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

commit be33c835ac30fcf45d33bd65e932b05b43aab00d
Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Jul 26 21:43:50 2018 +0900

    evas: handle all failure cases with error messages in evas_init
    
    Summary: fix T7026
    
    Reviewers: Hermet
    
    Reviewed By: Hermet
    
    Subscribers: cedric, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T7026
    
    Differential Revision: https://phab.enlightenment.org/D6677
---
 src/lib/evas/canvas/evas_main.c | 42 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 389c5ce6dd..ec3c99c0d6 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -48,11 +48,13 @@ evas_init(void)
      return --_evas_init_count;
 #endif
 
-   if (!eina_init())
-     goto shutdown_evil;
+   EINA_SAFETY_ON_FALSE_GOTO(eina_init(), shutdown_evil);
 
-   if (!eet_init())
-     goto shutdown_eet;
+   EINA_SAFETY_ON_FALSE_GOTO(eet_init(), shutdown_eet);
+#ifdef BUILD_LOADER_EET
+   /* additional init refcount; cannot fail */
+   eet_init();
+#endif
 
    _evas_log_dom_global = eina_log_domain_register
      ("evas_main", EVAS_DEFAULT_LOG_COLOR);
@@ -62,17 +64,12 @@ evas_init(void)
         goto shutdown_eina;
      }
 
-   efl_object_init();
+   EINA_SAFETY_ON_FALSE_GOTO(efl_object_init(), shutdown_eo);
 
-#ifdef BUILD_LOADER_EET
-   eet_init();
-#endif
-
-   ecore_init();
+   EINA_SAFETY_ON_FALSE_GOTO(ecore_init(), shutdown_ecore);
 
    evas_module_init();
-   if (!evas_async_events_init())
-     goto shutdown_module;
+   EINA_SAFETY_ON_FALSE_GOTO(evas_async_events_init(), shutdown_module);
 #ifdef EVAS_CSERVE2
    int cs2 = 0;
    {
@@ -81,7 +78,7 @@ evas_init(void)
       if (env && atoi(env))
         {
            cs2 = evas_cserve2_init();
-           if (!cs2) goto shutdown_async_events;
+           EINA_SAFETY_ON_FALSE_GOTO(cs2, shutdown_async_events);
         }
    }
 #endif
@@ -89,8 +86,7 @@ evas_init(void)
    evas_filter_init();
    evas_cache_vg_init();
 
-   if (!evas_thread_init())
-     goto shutdown_filter;
+   EINA_SAFETY_ON_FALSE_GOTO(evas_thread_init(), shutdown_filter);
 
    evas_common_init();
 
@@ -108,21 +104,23 @@ evas_init(void)
    _evas_preload_thread_shutdown();
 #ifdef EVAS_CSERVE2
    if (cs2) evas_cserve2_shutdown();
- shutdown_async_events:
+shutdown_async_events:
    evas_async_events_shutdown();
 #endif
- shutdown_module:
+shutdown_module:
    evas_module_shutdown();
+shutdown_ecore:
+   efl_object_shutdown();
+shutdown_eo:
+   eina_log_domain_unregister(_evas_log_dom_global);
+shutdown_eet:
 #ifdef BUILD_LOADER_EET
    eet_shutdown();
 #endif
-   efl_object_shutdown();
-   eina_log_domain_unregister(_evas_log_dom_global);
- shutdown_eet:
    eet_shutdown();
- shutdown_eina:
+shutdown_eina:
    eina_shutdown();
- shutdown_evil:
+shutdown_evil:
 #ifdef _WIN32
    evil_shutdown();
 #endif

-- 


Reply via email to