summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-04-15 13:02:54 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-04-15 13:15:21 +0100
commit6a0c8e9d2684b0d05ba9a4990160f04e6e4380e8 (patch)
tree6e7681620e1542573244cc8cf03276b4d4ebf544 /src/lib/elementary
parentcc55b7ef9896ddb13c2dcf4763c35432a7842e53 (diff)
elm menu - fix segv on deletion/shutdown where parent was not done ok
@fix
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/elm_menu.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c
index 7da2e551bd..5914a82eff 100644
--- a/src/lib/elementary/elm_menu.c
+++ b/src/lib/elementary/elm_menu.c
@@ -43,17 +43,31 @@ _elm_menu_efl_ui_l10n_translation_update(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
43 elm_wdg_item_translate(EO_OBJ(it)); 43 elm_wdg_item_translate(EO_OBJ(it));
44} 44}
45 45
46static void _item_del(Elm_Object_Item *eo_item);
47
48static void
49_elm_menu_subitems_clear(Elm_Menu_Item_Data *it)
50{
51 Elm_Object_Item *sub_it;
52
53 EINA_LIST_FREE(it->submenu.items, sub_it)
54 {
55 ELM_MENU_ITEM_DATA_GET(sub_it, item);
56
57 if (item)
58 {
59 item->parent = NULL;
60 _item_del(sub_it);
61 }
62 }
63}
64
46static void 65static void
47_item_del(Elm_Object_Item *eo_item) 66_item_del(Elm_Object_Item *eo_item)
48{ 67{
49 Elm_Object_Item *child;
50 ELM_MENU_ITEM_DATA_GET(eo_item, item); 68 ELM_MENU_ITEM_DATA_GET(eo_item, item);
51 69
52 Eina_List *itr, *itr2; 70 _elm_menu_subitems_clear(item);
53 EINA_LIST_FOREACH_SAFE(item->submenu.items, itr, itr2, child)
54 _item_del(child);
55 eina_list_free(item->submenu.items);
56
57 efl_del(eo_item); 71 efl_del(eo_item);
58} 72}
59 73
@@ -391,12 +405,10 @@ _parent_del_cb(void *data,
391 Evas_Object *obj, 405 Evas_Object *obj,
392 void *event_info EINA_UNUSED) 406 void *event_info EINA_UNUSED)
393{ 407{
394 ELM_MENU_DATA_GET(data, sd);
395 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); 408 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
396 409
397 evas_object_event_callback_del_full 410 evas_object_event_callback_del_full
398 (obj, EVAS_CALLBACK_RESIZE, _parent_resize_cb, data); 411 (obj, EVAS_CALLBACK_RESIZE, _parent_resize_cb, data);
399 sd->parent = NULL;
400} 412}
401 413
402static void 414static void
@@ -1013,7 +1025,7 @@ _elm_menu_item_efl_object_destructor(Eo *eo_item, Elm_Menu_Item_Data *item)
1013{ 1025{
1014 ELM_MENU_DATA_GET(WIDGET(item), sd); 1026 ELM_MENU_DATA_GET(WIDGET(item), sd);
1015 1027
1016 elm_menu_item_subitems_clear(eo_item); 1028 _elm_menu_subitems_clear(item);
1017 eina_stringshare_del(item->label); 1029 eina_stringshare_del(item->label);
1018 eina_stringshare_del(item->icon_str); 1030 eina_stringshare_del(item->icon_str);
1019 evas_object_del(item->content); 1031 evas_object_del(item->content);
@@ -1147,19 +1159,10 @@ _elm_menu_item_separator_add(Eo *obj, Elm_Menu_Data *sd, Elm_Object_Item *eo_p_i
1147 subitem = efl_data_scope_get(eo_subitem, ELM_MENU_ITEM_CLASS); 1159 subitem = efl_data_scope_get(eo_subitem, ELM_MENU_ITEM_CLASS);
1148 1160
1149 subitem->separator = EINA_TRUE; 1161 subitem->separator = EINA_TRUE;
1162 subitem->parent = efl_data_scope_get(eo_p_item, ELM_MENU_ITEM_CLASS);
1163
1150 _item_separator_obj_create(subitem); 1164 _item_separator_obj_create(subitem);
1151 if (!eo_p_item) 1165 _elm_menu_item_add_helper(obj, subitem->parent, subitem, sd);
1152 {
1153 elm_box_pack_end(sd->bx, VIEW(subitem));
1154 sd->items = eina_list_append(sd->items, eo_subitem);
1155 }
1156 else
1157 {
1158 if (!p_item->submenu.bx) _item_submenu_obj_create(p_item);
1159 elm_box_pack_end(p_item->submenu.bx, VIEW(subitem));
1160 p_item->submenu.items = eina_list_append
1161 (p_item->submenu.items, eo_subitem);
1162 }
1163 1166
1164 _sizing_eval(obj); 1167 _sizing_eval(obj);
1165 1168
@@ -1190,12 +1193,7 @@ _elm_menu_item_subitems_get(const Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *i
1190EOLIAN static void 1193EOLIAN static void
1191_elm_menu_item_subitems_clear(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *it) 1194_elm_menu_item_subitems_clear(Eo *eo_item EINA_UNUSED, Elm_Menu_Item_Data *it)
1192{ 1195{
1193 Elm_Object_Item *sub_it; 1196 _elm_menu_subitems_clear(it);
1194 Eina_List *l, *l_next;
1195
1196 EINA_LIST_FOREACH_SAFE(it->submenu.items,
1197 l, l_next, sub_it)
1198 efl_del(sub_it);
1199} 1197}
1200 1198
1201EOLIAN static const Eina_List * 1199EOLIAN static const Eina_List *