elementary/genlist - patched by PRINCE KUMAR DUBEY<prince.dubey@samsung.com>
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 29 Nov 2011 00:06:55 +0000 (00:06 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 29 Nov 2011 00:06:55 +0000 (00:06 +0000)
Hi,

On behalf of Rajeev Ranjan, I am submitting the elm_genlist patch.

Change Log:
a. Dead code removal in function _sizing_eval
b. Memory leak fix in function elm_genlist_item_insert_before due to return when wd->items is NULL and in this case, memory allocated for item was not getting free.
c. Memory leak fix in function elm_genlist_item_insert_after due to return when wd->items is NULL and in this case, memory allocated for item was not getting free.

Please review it.
I'd appreciate any comments on this.

Thank you,

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@65662 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_genlist.c

index bbed04b..85228ef 100644 (file)
@@ -642,14 +642,10 @@ _sizing_eval(Evas_Object *obj)
      }
    if (wd->mode == ELM_LIST_LIMIT)
      {
-        Evas_Coord vmw, vmh, vw, vh;
+        Evas_Coord vmw, vmh;
 
         minw = wd->realminw;
         maxw = -1;
-        elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
-        if ((minw > 0) && (vw < minw)) vw = minw;
-        else if ((maxw > 0) && (vw > maxw))
-          vw = maxw;
         edje_object_size_min_calc
           (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
         minw = vmw + minw;
@@ -3490,12 +3486,12 @@ elm_genlist_item_insert_after(Evas_Object                  *obj,
    EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return NULL;
-   Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
-                                    func_data);
-   if (!it) return NULL;
    /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
    EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
 
+   Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
+                                    func_data);
+   if (!it) return NULL;
    if (!it->parent)
      {
         if ((it->group) &&
@@ -3531,12 +3527,12 @@ elm_genlist_item_insert_before(Evas_Object                  *obj,
    EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return NULL;
-   Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
-                                    func_data);
-   if (!it) return NULL;
    /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
    EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
 
+   Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
+                                    func_data);
+   if (!it) return NULL;
    if (!it->parent)
      {
         if (it->group && before->group)