tasn pushed a commit to branch master.

commit f94850e84af4c03f5045a19ea4ba0bc311e0316e
Author: Daniel Willmann <[email protected]>
Date:   Mon Jun 10 16:41:30 2013 +0100

    ecore_init/shutdown: Proper refcounting for wrappers
    
    Signed-off-by: Daniel Willmann <[email protected]>
---
 src/lib/tsuite_evas_hook.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/lib/tsuite_evas_hook.c b/src/lib/tsuite_evas_hook.c
index a04ca26..5383fc8 100644
--- a/src/lib/tsuite_evas_hook.c
+++ b/src/lib/tsuite_evas_hook.c
@@ -219,10 +219,12 @@ tsuite_shot_do(char *name, Evas *e)
 EAPI int
 ecore_init(void)
 {
+   int ret;
    int (*_ecore_init)(void) =
       dlsym(RTLD_NEXT, "ecore_init");
 
-   if (!_hook_setting)
+   ret = _ecore_init();
+   if ((ret == 1) && (!_hook_setting))
      {
         const char *tmp;
         _hook_setting = calloc(1, sizeof(evas_hook_setting));
@@ -243,33 +245,38 @@ ecore_init(void)
           tsuite_evas_hook_init();
      }
 
-   return _ecore_init();
+   return ret;
 }
 
 EAPI int
 ecore_shutdown(void)
 {
+   int ret;
    int (*_ecore_shutdown)(void) =
       dlsym(RTLD_NEXT, "ecore_shutdown");
 
-   if (_hook_setting)
+   ret = _ecore_shutdown();
+   if (ret == 0)
      {
-        if (vr_list && _hook_setting->recording)
-          write_events(_hook_setting->file_name, vr_list);
+        if (_hook_setting)
+          {
+             if (vr_list && _hook_setting->recording)
+               write_events(_hook_setting->file_name, vr_list);
 
-        tsuite_evas_hook_reset();
+             tsuite_evas_hook_reset();
 
-        free(_hook_setting);
-        _hook_setting = NULL;
-     }
+             free(_hook_setting);
+             _hook_setting = NULL;
+          }
 
-   if (ts.td)
-     free(ts.td);
+        if (ts.td)
+          free(ts.td);
 
-   evas_list = eina_list_free(evas_list);
+        evas_list = eina_list_free(evas_list);
 
-   memset(&ts, 0, sizeof(Tsuite_Data));
-   return _ecore_shutdown();
+        memset(&ts, 0, sizeof(Tsuite_Data));
+     }
+   return ret;
 }
 
 EAPI Evas_Object *

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to