summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-26 13:22:44 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-07-29 11:17:37 -0700
commit44ff1e73bb7cefdf99c9cd68b250df0a497aa37d (patch)
tree0b840639ec2a2e7d471d2eb7e25f2313f7997ef9 /src
parentf7ce771e3243e19f8a12672ea2be752dedccbcf6 (diff)
efl_ui/popup: unset callbacks on win object when parent is removed
these callbacks must be removed if there is no parent, otherwise they may trigger once the widget is deleted and trigger invalid object access @fix Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9429
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_popup.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 8d7271eb67..5d97a7d9c2 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -96,8 +96,18 @@ _parent_geom_cb(void *data, const Efl_Event *ev EINA_UNUSED)
96} 96}
97 97
98EOLIAN static void 98EOLIAN static void
99_efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eo *parent EINA_UNUSED) 99_efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eo *parent)
100{ 100{
101 if (!parent)
102 {
103 /* unsetting parent, probably before deletion */
104 if (pd->win_parent)
105 {
106 efl_event_callback_del(pd->win_parent, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _parent_geom_cb, obj);
107 efl_event_callback_del(pd->win_parent, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _parent_geom_cb, obj);
108 }
109 goto end;
110 }
101 pd->win_parent = efl_provider_find(obj, EFL_UI_WIN_CLASS); 111 pd->win_parent = efl_provider_find(obj, EFL_UI_WIN_CLASS);
102 if (!pd->win_parent) 112 if (!pd->win_parent)
103 { 113 {
@@ -112,7 +122,7 @@ _efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EIN
112 122
113 efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _parent_geom_cb, obj); 123 efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _parent_geom_cb, obj);
114 efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _parent_geom_cb, obj); 124 efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _parent_geom_cb, obj);
115 125end:
116 efl_ui_widget_parent_set(efl_super(obj, MY_CLASS), parent); 126 efl_ui_widget_parent_set(efl_super(obj, MY_CLASS), parent);
117} 127}
118 128