forked from enlightenment/efl
Efl.Ui.Popup.Anchor: remove event callback when popup is deleted
Summary: When popup is deleted, popup didn't remove event callback which its parent and anchor object. So before popup destruction, detach anchor. Test Plan: elementary_test -to efl.ui.popup.anchor Reviewers: Jaehyun_Cho, herb, woohyun, jpeg, cedric Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5667
This commit is contained in:
parent
845d6d1b57
commit
e8735068ac
|
@ -23,16 +23,9 @@ _anchor_calc(Eo *obj)
|
||||||
|
|
||||||
Eina_Position2D pos = {0, 0};
|
Eina_Position2D pos = {0, 0};
|
||||||
|
|
||||||
Eo *parent = efl_provider_find(obj, EFL_UI_WIN_CLASS);
|
|
||||||
if (!parent)
|
|
||||||
{
|
|
||||||
ERR("Cannot find window parent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Rect a_geom = efl_gfx_geometry_get(pd->anchor);
|
Eina_Rect a_geom = efl_gfx_geometry_get(pd->anchor);
|
||||||
Eina_Rect o_geom = efl_gfx_geometry_get(obj);
|
Eina_Rect o_geom = efl_gfx_geometry_get(obj);
|
||||||
Eina_Rect p_geom = efl_gfx_geometry_get(parent);
|
Eina_Rect p_geom = efl_gfx_geometry_get(ppd->win_parent);
|
||||||
|
|
||||||
pd->used_align = EFL_UI_POPUP_ALIGN_NONE;
|
pd->used_align = EFL_UI_POPUP_ALIGN_NONE;
|
||||||
|
|
||||||
|
@ -214,14 +207,7 @@ _anchor_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
EFL_UI_POPUP_DATA_GET_OR_RETURN(data, ppd);
|
EFL_UI_POPUP_DATA_GET_OR_RETURN(data, ppd);
|
||||||
EFL_UI_POPUP_ANCHOR_DATA_GET(data, pd);
|
EFL_UI_POPUP_ANCHOR_DATA_GET(data, pd);
|
||||||
|
|
||||||
Eo *parent = efl_provider_find(data, EFL_UI_WIN_CLASS);
|
efl_event_callback_del(ppd->win_parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, data);
|
||||||
if (!parent)
|
|
||||||
{
|
|
||||||
ERR("Cannot find window parent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
efl_event_callback_del(parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, data);
|
|
||||||
|
|
||||||
pd->anchor = NULL;
|
pd->anchor = NULL;
|
||||||
//Add align calc only
|
//Add align calc only
|
||||||
|
@ -233,18 +219,12 @@ _anchor_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
static void
|
static void
|
||||||
_anchor_detach(Eo *obj)
|
_anchor_detach(Eo *obj)
|
||||||
{
|
{
|
||||||
|
EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
|
||||||
EFL_UI_POPUP_ANCHOR_DATA_GET(obj, pd);
|
EFL_UI_POPUP_ANCHOR_DATA_GET(obj, pd);
|
||||||
|
|
||||||
if (!pd->anchor) return;
|
if (!pd->anchor) return;
|
||||||
|
|
||||||
Eo *parent = efl_provider_find(obj, EFL_UI_WIN_CLASS);
|
efl_event_callback_del(ppd->win_parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
||||||
if (!parent)
|
|
||||||
{
|
|
||||||
ERR("Cannot find window parent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
efl_event_callback_del(parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
|
||||||
efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
||||||
efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj);
|
efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj);
|
||||||
efl_event_callback_del(pd->anchor, EFL_EVENT_DEL, _anchor_del_cb, obj);
|
efl_event_callback_del(pd->anchor, EFL_EVENT_DEL, _anchor_del_cb, obj);
|
||||||
|
@ -260,14 +240,7 @@ _efl_ui_popup_anchor_anchor_set(Eo *obj, Efl_Ui_Popup_Anchor_Data *pd, Eo *ancho
|
||||||
|
|
||||||
if (anchor)
|
if (anchor)
|
||||||
{
|
{
|
||||||
Eo *parent = efl_provider_find(obj, EFL_UI_WIN_CLASS);
|
efl_event_callback_add(ppd->win_parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
||||||
if (!parent)
|
|
||||||
{
|
|
||||||
ERR("Cannot find window parent");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
efl_event_callback_add(parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
|
||||||
efl_event_callback_add(anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
efl_event_callback_add(anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
|
||||||
efl_event_callback_add(anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj);
|
efl_event_callback_add(anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj);
|
||||||
efl_event_callback_add(anchor, EFL_EVENT_DEL, _anchor_del_cb, obj);
|
efl_event_callback_add(anchor, EFL_EVENT_DEL, _anchor_del_cb, obj);
|
||||||
|
@ -369,4 +342,13 @@ _efl_ui_popup_anchor_efl_object_constructor(Eo *obj,
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_popup_anchor_efl_object_destructor(Eo *obj,
|
||||||
|
Efl_Ui_Popup_Anchor_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_anchor_detach(obj);
|
||||||
|
|
||||||
|
efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
#include "efl_ui_popup_anchor.eo.c"
|
#include "efl_ui_popup_anchor.eo.c"
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Efl.Ui.Popup_Anchor(Efl.Ui.Popup)
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
|
Efl.Object.destructor;
|
||||||
Efl.Canvas.Group.group_calculate;
|
Efl.Canvas.Group.group_calculate;
|
||||||
Efl.Gfx.position { set; }
|
Efl.Gfx.position { set; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue