Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_embed.c 


Log Message:
- add checks to make sure obj_cache exists before using it

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -3 -r1.102 -r1.103
--- ewl_embed.c 17 Dec 2006 03:00:38 -0000      1.102
+++ ewl_embed.c 3 Jan 2007 21:35:35 -0000       1.103
@@ -1205,6 +1205,8 @@
        DCHECK_PARAM_PTR_RET("type", type, NULL);
        DCHECK_TYPE_RET("e", e, EWL_EMBED_TYPE, NULL);
 
+       if (!e->obj_cache) return NULL;
+
        obj_list = ecore_hash_get(e->obj_cache, type);
        if (obj_list)
                obj = ecore_list_remove_first(obj_list);
@@ -1980,29 +1982,32 @@
        if (ecore_list_goto(ewl_embed_list, w))
                ecore_list_remove(ewl_embed_list);
 
-       key_list = ecore_hash_keys(emb->obj_cache);
-       if (key_list) {
-               char *key;
-               /*
-                * Iterate over all object types destroying them as we go. No
-                * need to free the key string.
-                */
-               while ((key = ecore_list_remove_first(key_list))) {
-                       Ecore_List *obj_list;
-
+       if (emb->obj_cache)
+       {
+               key_list = ecore_hash_keys(emb->obj_cache);
+               if (key_list) {
+                       char *key;
                        /*
-                        * Now queue all objects for destruction.
+                        * Iterate over all object types destroying them as we 
go. No
+                        * need to free the key string.
                         */
-                       obj_list = ecore_hash_remove(emb->obj_cache, key);
-                       while ((obj = ecore_list_remove_first(obj_list)))
-                               ewl_evas_object_destroy(obj);
-                       ecore_list_destroy(obj_list);
-               }
+                       while ((key = ecore_list_remove_first(key_list))) {
+                               Ecore_List *obj_list;
 
-               ecore_list_destroy(key_list);
+                               /*
+                                * Now queue all objects for destruction.
+                                */
+                               obj_list = ecore_hash_remove(emb->obj_cache, 
key);
+                               while ((obj = 
ecore_list_remove_first(obj_list)))
+                                       ewl_evas_object_destroy(obj);
+                               ecore_list_destroy(obj_list);
+                       }
+
+                       ecore_list_destroy(key_list);
+               }
        }
 
-       ecore_hash_destroy(emb->obj_cache);
+       if (emb->obj_cache) ecore_hash_destroy(emb->obj_cache);
        emb->obj_cache = NULL;
 
        ecore_dlist_destroy(emb->tab_order);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to