Enlightenment CVS committal

Author  : tsauerbeck
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore


Modified Files:
        Ecore.h ecore.c 


Log Message:
add ecore refcounting, so ewl doesn't break apps that have their own ecore main loop
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Ecore.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Ecore.h     12 Oct 2003 05:48:34 -0000      1.3
+++ Ecore.h     3 Feb 2004 19:49:46 -0000       1.4
@@ -78,7 +78,7 @@
      };
 
    int  ecore_init(void);
-   void ecore_shutdown(void);
+   int  ecore_shutdown(void);
        
    void ecore_app_args_set(int argc, const char **argv);
    void ecore_app_args_get(int *argc, char ***argv);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ecore.c     23 Sep 2003 08:09:29 -0000      1.2
+++ ecore.c     3 Feb 2004 19:49:46 -0000       1.3
@@ -2,6 +2,7 @@
 #include "Ecore.h"
 
 static const char *_ecore_magic_string_get(Ecore_Magic m);
+static int _ecore_init_count = 0;
 
 /**
  * Set up connections, signal handlers, sockets etc.
@@ -29,8 +30,10 @@
 int
 ecore_init(void)
 {
-   _ecore_signal_init();
-   return 1;
+   if (++_ecore_init_count == 1)
+      _ecore_signal_init();
+
+   return _ecore_init_count;
 }
 
 /**
@@ -44,9 +47,12 @@
  * loop, as the main loop will then fall over and not function properly.
  * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
 */
-void
+int
 ecore_shutdown(void)
 {
+   if (--_ecore_init_count)
+      return _ecore_init_count;
+
    _ecore_exe_shutdown();
    _ecore_idle_enterer_shutdown();
    _ecore_idler_shutdown();
@@ -54,6 +60,8 @@
    _ecore_event_shutdown();
    _ecore_main_shutdown();
    _ecore_signal_shutdown();
+
+   return _ecore_init_count;
 }
 
 void




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to