summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJinYong Park <j4939.park@samsung.com>2017-12-18 14:08:08 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-12-18 14:08:09 +0900
commite8735068aca1717b19b3379d58ab592d8e34dd0e (patch)
treef474b104b1dfcdcf8d6691cd99c609587f9f6a76 /src/lib
parent845d6d1b57b207f09b351a923b02c5330907a5d4 (diff)
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
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_popup_anchor.c46
-rw-r--r--src/lib/elementary/efl_ui_popup_anchor.eo1
2 files changed, 15 insertions, 32 deletions
diff --git a/src/lib/elementary/efl_ui_popup_anchor.c b/src/lib/elementary/efl_ui_popup_anchor.c
index c1bf965b8b..9112a0cc5b 100644
--- a/src/lib/elementary/efl_ui_popup_anchor.c
+++ b/src/lib/elementary/efl_ui_popup_anchor.c
@@ -23,16 +23,9 @@ _anchor_calc(Eo *obj)
23 23
24 Eina_Position2D pos = {0, 0}; 24 Eina_Position2D pos = {0, 0};
25 25
26 Eo *parent = efl_provider_find(obj, EFL_UI_WIN_CLASS);
27 if (!parent)
28 {
29 ERR("Cannot find window parent");
30 return;
31 }
32
33 Eina_Rect a_geom = efl_gfx_geometry_get(pd->anchor); 26 Eina_Rect a_geom = efl_gfx_geometry_get(pd->anchor);
34 Eina_Rect o_geom = efl_gfx_geometry_get(obj); 27 Eina_Rect o_geom = efl_gfx_geometry_get(obj);
35 Eina_Rect p_geom = efl_gfx_geometry_get(parent); 28 Eina_Rect p_geom = efl_gfx_geometry_get(ppd->win_parent);
36 29
37 pd->used_align = EFL_UI_POPUP_ALIGN_NONE; 30 pd->used_align = EFL_UI_POPUP_ALIGN_NONE;
38 31
@@ -214,14 +207,7 @@ _anchor_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
214 EFL_UI_POPUP_DATA_GET_OR_RETURN(data, ppd); 207 EFL_UI_POPUP_DATA_GET_OR_RETURN(data, ppd);
215 EFL_UI_POPUP_ANCHOR_DATA_GET(data, pd); 208 EFL_UI_POPUP_ANCHOR_DATA_GET(data, pd);
216 209
217 Eo *parent = efl_provider_find(data, EFL_UI_WIN_CLASS); 210 efl_event_callback_del(ppd->win_parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, data);
218 if (!parent)
219 {
220 ERR("Cannot find window parent");
221 return;
222 }
223
224 efl_event_callback_del(parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, data);
225 211
226 pd->anchor = NULL; 212 pd->anchor = NULL;
227 //Add align calc only 213 //Add align calc only
@@ -233,18 +219,12 @@ _anchor_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
233static void 219static void
234_anchor_detach(Eo *obj) 220_anchor_detach(Eo *obj)
235{ 221{
222 EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
236 EFL_UI_POPUP_ANCHOR_DATA_GET(obj, pd); 223 EFL_UI_POPUP_ANCHOR_DATA_GET(obj, pd);
237 224
238 if (!pd->anchor) return; 225 if (!pd->anchor) return;
239 226
240 Eo *parent = efl_provider_find(obj, EFL_UI_WIN_CLASS); 227 efl_event_callback_del(ppd->win_parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
241 if (!parent)
242 {
243 ERR("Cannot find window parent");
244 return;
245 }
246
247 efl_event_callback_del(parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
248 efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj); 228 efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
249 efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj); 229 efl_event_callback_del(pd->anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj);
250 efl_event_callback_del(pd->anchor, EFL_EVENT_DEL, _anchor_del_cb, obj); 230 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
260 240
261 if (anchor) 241 if (anchor)
262 { 242 {
263 Eo *parent = efl_provider_find(obj, EFL_UI_WIN_CLASS); 243 efl_event_callback_add(ppd->win_parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
264 if (!parent)
265 {
266 ERR("Cannot find window parent");
267 return;
268 }
269
270 efl_event_callback_add(parent, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
271 efl_event_callback_add(anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj); 244 efl_event_callback_add(anchor, EFL_GFX_EVENT_RESIZE, _anchor_geom_cb, obj);
272 efl_event_callback_add(anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj); 245 efl_event_callback_add(anchor, EFL_GFX_EVENT_MOVE, _anchor_geom_cb, obj);
273 efl_event_callback_add(anchor, EFL_EVENT_DEL, _anchor_del_cb, obj); 246 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,
369 return obj; 342 return obj;
370} 343}
371 344
345EOLIAN static void
346_efl_ui_popup_anchor_efl_object_destructor(Eo *obj,
347 Efl_Ui_Popup_Anchor_Data *pd EINA_UNUSED)
348{
349 _anchor_detach(obj);
350
351 efl_destructor(efl_super(obj, MY_CLASS));
352}
353
372#include "efl_ui_popup_anchor.eo.c" 354#include "efl_ui_popup_anchor.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_anchor.eo b/src/lib/elementary/efl_ui_popup_anchor.eo
index 1bdd8684e6..9490e491ce 100644
--- a/src/lib/elementary/efl_ui_popup_anchor.eo
+++ b/src/lib/elementary/efl_ui_popup_anchor.eo
@@ -35,6 +35,7 @@ class Efl.Ui.Popup_Anchor(Efl.Ui.Popup)
35 } 35 }
36 implements { 36 implements {
37 Efl.Object.constructor; 37 Efl.Object.constructor;
38 Efl.Object.destructor;
38 Efl.Canvas.Group.group_calculate; 39 Efl.Canvas.Group.group_calculate;
39 Efl.Gfx.position { set; } 40 Efl.Gfx.position { set; }
40 } 41 }