summaryrefslogtreecommitdiff
path: root/src/lib/elm_toolbar.c
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2015-04-27 10:53:28 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-04-27 10:53:28 +0900
commit46121f377326cb73fa15ac93033909408ba3bb4e (patch)
tree8cc8348238fc1536922896e0ab2c1fae45e4e2ad /src/lib/elm_toolbar.c
parent79fb192b50d1891950428b1ecd31bedbcbbcf506 (diff)
elm_toolbar: fix memory leaks
Summary: incorrect evas_object_box_children_get usage: returned list must be freed @fix Reviewers: cedric, seoz, raster, reutskiy.v.v, Hermet Differential Revision: https://phab.enlightenment.org/D2412
Diffstat (limited to 'src/lib/elm_toolbar.c')
-rw-r--r--src/lib/elm_toolbar.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index 93e1b25d4..0087a0a43 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -576,6 +576,7 @@ _resize_job(void *data)
576 evas_object_hide(VIEW(it)); 576 evas_object_hide(VIEW(it));
577 } 577 }
578 } 578 }
579 eina_list_free(list);
579 list = evas_object_box_children_get(sd->bx_more2); 580 list = evas_object_box_children_get(sd->bx_more2);
580 EINA_INLIST_FOREACH(sd->items, it) 581 EINA_INLIST_FOREACH(sd->items, it)
581 { 582 {
@@ -588,6 +589,7 @@ _resize_job(void *data)
588 evas_object_hide(VIEW(it)); 589 evas_object_hide(VIEW(it));
589 } 590 }
590 } 591 }
592 eina_list_free(list);
591 593
592 _mirrored_set(obj, elm_widget_mirrored_get(obj)); 594 _mirrored_set(obj, elm_widget_mirrored_get(obj));
593} 595}
@@ -780,14 +782,14 @@ static Elm_Toolbar_Item_Data *
780_focus_next_item_get(Evas_Object *obj, Eina_Bool reverse) 782_focus_next_item_get(Evas_Object *obj, Eina_Bool reverse)
781{ 783{
782 ELM_TOOLBAR_DATA_GET(obj, sd); 784 ELM_TOOLBAR_DATA_GET(obj, sd);
783 Eina_List *list = NULL; 785 Eina_List *list = NULL, *children_list;
784 Elm_Toolbar_Item_Data *it = NULL; 786 Elm_Toolbar_Item_Data *it = NULL;
785 Evas_Object *it_obj = NULL; 787 Evas_Object *it_obj = NULL;
786 788
787 list = evas_object_box_children_get(sd->bx); 789 children_list = evas_object_box_children_get(sd->bx);
788 if (reverse) 790 if (reverse)
789 list = eina_list_reverse(list); 791 children_list = eina_list_reverse(children_list);
790 792 list = children_list;
791 if (sd->focused_item) 793 if (sd->focused_item)
792 { 794 {
793 ELM_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it); 795 ELM_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it);
@@ -812,6 +814,7 @@ _focus_next_item_get(Evas_Object *obj, Eina_Bool reverse)
812 if (it_obj) it = evas_object_data_get(it_obj, "item"); 814 if (it_obj) it = evas_object_data_get(it_obj, "item");
813 else it = NULL; 815 else it = NULL;
814 } 816 }
817 eina_list_free(children_list);
815 818
816 return it; 819 return it;
817} 820}
@@ -1062,6 +1065,7 @@ _item_select(Elm_Toolbar_Item_Data *it)
1062 Evas_Object *obj; 1065 Evas_Object *obj;
1063 Eina_Bool sel; 1066 Eina_Bool sel;
1064 Eina_Bool tmp; 1067 Eina_Bool tmp;
1068 Eina_List *list;
1065 1069
1066 ELM_TOOLBAR_DATA_GET(WIDGET(it), sd); 1070 ELM_TOOLBAR_DATA_GET(WIDGET(it), sd);
1067 1071
@@ -1098,12 +1102,14 @@ _item_select(Elm_Toolbar_Item_Data *it)
1098 { 1102 {
1099 if (sd->more_item == it) 1103 if (sd->more_item == it)
1100 { 1104 {
1101 if (!evas_object_box_children_get(sd->bx_more2)) 1105 list = evas_object_box_children_get(sd->bx_more2);
1106 if (!list)
1102 elm_layout_signal_emit 1107 elm_layout_signal_emit
1103 (sd->more, "elm,state,open", "elm"); 1108 (sd->more, "elm,state,open", "elm");
1104 else 1109 else
1105 elm_layout_signal_emit 1110 elm_layout_signal_emit
1106 (sd->more, "elm,state,open2", "elm"); 1111 (sd->more, "elm,state,open2", "elm");
1112 eina_list_free(list);
1107 } 1113 }
1108 else 1114 else
1109 { 1115 {
@@ -1899,6 +1905,7 @@ _animate_missed_items(Elm_Toolbar_Item_Data *prev, Elm_Toolbar_Item_Data *next)
1899 else 1905 else
1900 l = eina_list_prev(l); 1906 l = eina_list_prev(l);
1901 } 1907 }
1908 eina_list_free(list);
1902} 1909}
1903 1910
1904static void 1911static void
@@ -2799,6 +2806,7 @@ _access_item_find_append(const Evas_Object *obj,
2799 if (eina_list_data_find(list, it->base->view)) 2806 if (eina_list_data_find(list, it->base->view))
2800 items = eina_list_append(items, it->base->access_obj); 2807 items = eina_list_append(items, it->base->access_obj);
2801 } 2808 }
2809 eina_list_free(list);
2802 2810
2803 return items; 2811 return items;
2804} 2812}
@@ -2815,6 +2823,7 @@ EOLIAN static Eina_Bool
2815_elm_toolbar_elm_widget_focus_next(Eo *obj, Elm_Toolbar_Data *sd, Elm_Focus_Direction dir, Evas_Object **next) 2823_elm_toolbar_elm_widget_focus_next(Eo *obj, Elm_Toolbar_Data *sd, Elm_Focus_Direction dir, Evas_Object **next)
2816{ 2824{
2817 Eina_List *items = NULL; 2825 Eina_List *items = NULL;
2826 Eina_List *list;
2818 2827
2819 if (sd->more_item && sd->more_item->selected) 2828 if (sd->more_item && sd->more_item->selected)
2820 { 2829 {
@@ -2825,10 +2834,10 @@ _elm_toolbar_elm_widget_focus_next(Eo *obj, Elm_Toolbar_Data *sd, Elm_Focus_Dire
2825 else 2834 else
2826 { 2835 {
2827 items = _access_item_find_append(obj, sd->bx, items); 2836 items = _access_item_find_append(obj, sd->bx, items);
2828 if (sd->more_item && 2837 list = evas_object_box_children_get(sd->bx);
2829 eina_list_data_find(evas_object_box_children_get(sd->bx), 2838 if (sd->more_item && eina_list_data_find(list, sd->more_item->base->view))
2830 sd->more_item->base->view))
2831 items = eina_list_append(items, sd->more_item->base->access_obj); 2839 items = eina_list_append(items, sd->more_item->base->access_obj);
2840 eina_list_free(list);
2832 } 2841 }
2833 2842
2834 return elm_widget_focus_list_next_get 2843 return elm_widget_focus_list_next_get