tasn pushed a commit to branch master.

commit b4b7e65edd600dd309128b91ff51a8ca1c8d29bb
Author: Tom Hacohen <[email protected]>
Date:   Thu Jun 13 13:44:44 2013 +0100

    Fix initialization issues (and thus some segfaults).
    
    Init ecore before using it, shutdown after done.
    Init eet, as we need it as well.
---
 src/lib/tsuite_evas_hook.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/lib/tsuite_evas_hook.c b/src/lib/tsuite_evas_hook.c
index 5383fc8..bee6d47 100644
--- a/src/lib/tsuite_evas_hook.c
+++ b/src/lib/tsuite_evas_hook.c
@@ -216,6 +216,8 @@ tsuite_shot_do(char *name, Evas *e)
    free(filename);
 }
 
+static int _ecore_init_count = 0;
+
 EAPI int
 ecore_init(void)
 {
@@ -223,8 +225,12 @@ ecore_init(void)
    int (*_ecore_init)(void) =
       dlsym(RTLD_NEXT, "ecore_init");
 
+   _ecore_init_count++;
+
    ret = _ecore_init();
-   if ((ret == 1) && (!_hook_setting))
+   eet_init();
+
+   if ((_ecore_init_count == 1) && (!_hook_setting))
      {
         const char *tmp;
         _hook_setting = calloc(1, sizeof(evas_hook_setting));
@@ -251,12 +257,12 @@ ecore_init(void)
 EAPI int
 ecore_shutdown(void)
 {
-   int ret;
    int (*_ecore_shutdown)(void) =
       dlsym(RTLD_NEXT, "ecore_shutdown");
 
-   ret = _ecore_shutdown();
-   if (ret == 0)
+   _ecore_init_count--;
+
+   if (_ecore_init_count == 0)
      {
         if (_hook_setting)
           {
@@ -276,7 +282,9 @@ ecore_shutdown(void)
 
         memset(&ts, 0, sizeof(Tsuite_Data));
      }
-   return ret;
+
+   eet_shutdown();
+   return _ecore_shutdown();
 }
 
 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