cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=44ff1e73bb7cefdf99c9cd68b250df0a497aa37d
commit 44ff1e73bb7cefdf99c9cd68b250df0a497aa37d Author: Mike Blumenkrantz <[email protected]> Date: Fri Jul 26 13:22:44 2019 -0400 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 <[email protected]> Differential Revision: https://phab.enlightenment.org/D9429 --- src/lib/elementary/efl_ui_popup.c | 14 ++++++++++++-- 1 file 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) } EOLIAN static void -_efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eo *parent EINA_UNUSED) +_efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eo *parent) { + if (!parent) + { + /* unsetting parent, probably before deletion */ + if (pd->win_parent) + { + efl_event_callback_del(pd->win_parent, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _parent_geom_cb, obj); + efl_event_callback_del(pd->win_parent, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _parent_geom_cb, obj); + } + goto end; + } pd->win_parent = efl_provider_find(obj, EFL_UI_WIN_CLASS); if (!pd->win_parent) { @@ -112,7 +122,7 @@ _efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EIN efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _parent_geom_cb, obj); efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _parent_geom_cb, obj); - +end: efl_ui_widget_parent_set(efl_super(obj, MY_CLASS), parent); } --
