ibar - fix shutdown if ibar client menu is up

valgrind pointed out a referencing issue with the ibar client menu on
hover and if e is shut down while this is up. it ends up referencing
an already deleted ibar icon, so delete the menu objects that
reference the icon if icon is deleted.

This commit is contained in:
Carsten Haitzler 2015-11-10 18:51:56 +09:00
parent 551657e02a
commit 3195b760ee
1 changed files with 10 additions and 1 deletions

View File

@ -69,6 +69,7 @@ struct _IBar_Icon
IBar *ibar;
Evas_Object *o_holder, *o_icon;
Evas_Object *o_holder2, *o_icon2;
Eina_List *client_objs;
Efreet_Desktop *app;
Ecore_Timer *reset_timer;
Ecore_Timer *timer;
@ -875,7 +876,9 @@ static void
_ibar_icon_free(IBar_Icon *ic)
E_Exec_Instance *inst;
Evas_Object *o;
EINA_LIST_FREE(ic->client_objs, o) evas_object_del(o);
if (ic->ibar->menu_icon == ic) ic->ibar->menu_icon = NULL;
if (ic->ibar->ic_drop_before == ic) ic->ibar->ic_drop_before = NULL;
if (ic->menu) e_object_data_set(E_OBJECT(ic->menu), NULL);
@ -1214,9 +1217,11 @@ _ibar_cb_icon_menu_img_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, vo
int w, h;
E_Client *ec;
IBar_Icon *ic = evas_object_data_del(data, "ibar_icon");
IBar_Icon *ic;
ic = evas_object_data_del(data, "ibar_icon");
if (!ic) return; //menu is closing
if (ic) ic->client_objs = eina_list_remove(ic->client_objs, obj);
if (!ic->menu) return; //who knows
edje_object_part_box_remove(ic->menu->o_bg, "e.box", data);
ec = evas_object_data_get(obj, "E_Client");
@ -1279,6 +1284,8 @@ _ibar_icon_menu_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
static void
_ibar_cb_icon_frame_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
IBar_Icon *ic = evas_object_data_del(obj, "ibar_icon");
if (ic) ic->client_objs = eina_list_remove(ic->client_objs, obj);
e_comp_object_signal_callback_del_full(data, "e,state,*focused", "e", _ibar_cb_icon_menu_focus_change, obj);
evas_object_smart_callback_del_full(data, "desk_change", _ibar_cb_icon_menu_desk_change, obj);
@ -1293,10 +1300,12 @@ _ibar_icon_menu_client_add(IBar_Icon *ic, E_Client *ec)
if (ec->netwm.state.skip_taskbar) return EINA_FALSE;
o = ic->menu->o_bg;
it = edje_object_add(e_comp->evas);
ic->client_objs = eina_list_append(ic->client_objs, it);
e_comp_object_util_del_list_append(ic->menu->comp_object, it);
e_theme_edje_object_set(it, "base/theme/modules/ibar",
img = e_comp_object_util_mirror_add(ec->frame);
ic->client_objs = eina_list_append(ic->client_objs, img);
e_comp_object_signal_callback_add(ec->frame, "e,state,*focused", "e", _ibar_cb_icon_menu_focus_change, it);
evas_object_smart_callback_add(ec->frame, "desk_change", _ibar_cb_icon_menu_desk_change, it);
evas_object_event_callback_add(it, EVAS_CALLBACK_DEL,