more memory management improvements. applications should call edje_shutdown() now.
authortsauerbeck <tsauerbeck>
Mon, 12 Jan 2004 17:41:48 +0000 (17:41 +0000)
committertsauerbeck <tsauerbeck@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 12 Jan 2004 17:41:48 +0000 (17:41 +0000)
SVN revision: 8355

legacy/edje/src/lib/Edje.h
legacy/edje/src/lib/edje_data.c
legacy/edje/src/lib/edje_main.c
legacy/edje/src/lib/edje_private.h

index fb11c111644a6f4db1a3fbe0982efa7f6b29a6bd..1781e6b5bc4398200b69867ab1f77719787c4f0c 100644 (file)
@@ -21,6 +21,7 @@ extern "C" {
 #endif
    
    void         edje_init                       (void);
+   void         edje_shutdown                   (void);
    void         edje_frametime_set              (double t);
    double       edje_frametime_get              (void);
    void         edje_freeze                     (void);
index 71bf1be7d75784009d585a7916e7d28145c7cbac..7848b64ae2045b0144efc3ddc2a073746c2ba8a9 100644 (file)
@@ -24,6 +24,30 @@ Eet_Data_Descriptor *_edje_edd_edje_part_image_id = NULL;
                              (void *(*) (void *, const char *, void *))evas_hash_add, \
                              (void  (*) (void *))evas_hash_free)
 
+#define FREED(eed) \
+   if (eed) \
+   { \
+      eet_data_descriptor_free((eed)); \
+      (eed) = NULL; \
+   }
+
+void
+_edje_edd_free(void)
+{
+   FREED(_edje_edd_edje_file);
+   FREED(_edje_edd_edje_data);
+   FREED(_edje_edd_edje_image_directory);
+   FREED(_edje_edd_edje_image_directory_entry);
+   FREED(_edje_edd_edje_program);
+   FREED(_edje_edd_edje_program_target);
+   FREED(_edje_edd_edje_part_collection_directory);
+   FREED(_edje_edd_edje_part_collection_directory_entry);
+   FREED(_edje_edd_edje_part_collection);
+   FREED(_edje_edd_edje_part);
+   FREED(_edje_edd_edje_part_description);
+   FREED(_edje_edd_edje_part_image_id);
+}
+
 void
 _edje_edd_setup(void)
 {
index 58a5370be06e1ea6130d4a34bc70f625495ca5a8..e0b839c657802cee968520484d034b8963e5a153 100644 (file)
@@ -1,17 +1,27 @@
 #include "Edje.h"
 #include "edje_private.h"
 
+static int initted = 0;
+
 void
 edje_init(void)
 {
-   static int initted = 0;
-   
    if (initted) return;
    initted = 1;
    _edje_edd_setup();
    _edje_text_init();
 }
 
+void
+edje_shutdown(void)
+{
+   if (!initted) return;
+
+   _edje_edd_free();
+
+   initted = 0;
+}
+
 Edje *
 _edje_add(Evas_Object *obj)
 {
index 03c9c5f636b5e0b068f9e4c3afe6ddead34974c2..9c2968f25072e678b7e8540efe2866dbdd7f6000 100644 (file)
@@ -560,6 +560,7 @@ int   _edje_timer_cb(void *data);
 int   _edje_pending_timer_cb(void *data);
 
 void  _edje_edd_setup(void);
+void  _edje_edd_free(void);
 
 void  _edje_file_add(Edje *ed);
 void  _edje_file_del(Edje *ed);