furrymyad pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a21f0535717c26ac23d5a22f337cbdbcea3998cc

commit a21f0535717c26ac23d5a22f337cbdbcea3998cc
Author: Vitalii Vorobiov <[email protected]>
Date:   Thu Mar 19 15:19:55 2015 +0200

    Edje: edje edit - ability to remove last item in BOX/TABLE
    
    Removing last item in BOX/TABLE part is actually successful
    but then we shouldn't realloc an array of items for 0 items.
    That's ridiculous
    (and because of that function removes EINA_FALSE,
    so user could think that it's unable to remove last item).
    
    So simply array can be set into NULL.
    
    @fix
---
 src/lib/edje/edje_edit.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 497be60..216d85c 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -4556,13 +4556,18 @@ edje_edit_part_item_del(Evas_Object *obj, const char 
*part, const char* name)
            i++;
         }
 
-      tmp = realloc(ep->items, sizeof(Edje_Pack_Element *) * ep->items_count);
-      if (!tmp)
+      if (ep->items_count != 0)
         {
-           free(item);
-           return EINA_FALSE;
+           tmp = realloc(ep->items, sizeof(Edje_Pack_Element *) * 
ep->items_count);
+           if (!tmp)
+             {
+                free(item);
+                return EINA_FALSE;
+             }
+           ep->items = tmp;
         }
-      ep->items = tmp;
+      else
+        ep->items = NULL;
    }
 
    GET_EED_OR_RETURN(EINA_FALSE);

-- 


Reply via email to