bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6d0b0baf9bec36a364224eb6e6c5d53adc4f2adf
commit 6d0b0baf9bec36a364224eb6e6c5d53adc4f2adf Author: Marcel Hollerbach <m...@marcel-hollerbach.de> Date: Fri Jul 12 18:39:07 2019 +0200 efl_ui_spotlight_container: fix ownership behavior of view_manager view_manager is a property that takes ownership of the view_manager object. We are setting the parent in the setter which means, we should actaully have one ref to the parent, and one from the caller, so we need to unref one. Differential Revision: https://phab.enlightenment.org/D9304 --- src/bin/elementary/test_ui_tab_pager.c | 2 -- src/lib/elementary/efl_ui_spotlight_container.c | 7 ++++--- src/lib/elementary/efl_ui_spotlight_util.c | 2 +- src/tests/elementary/efl_ui_test_spotlight.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c index fe7dc968f7..ab0559276e 100644 --- a/src/bin/elementary/test_ui_tab_pager.c +++ b/src/bin/elementary/test_ui_tab_pager.c @@ -558,7 +558,6 @@ _tran_set_btn_scroll_cb(void *data, const Efl_Event *ev EINA_UNUSED) { Efl_Ui_Spotlight_Manager_Scroll *scroll = efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS); efl_ui_spotlight_manager_set(data, scroll); - efl_unref(scroll); } static void @@ -566,7 +565,6 @@ _tran_set_btn_stack_cb(void *data, const Efl_Event *ev EINA_UNUSED) { Efl_Ui_Spotlight_Manager_Scroll *stack = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS); efl_ui_spotlight_manager_set(data, stack); - efl_unref(stack); } static void diff --git a/src/lib/elementary/efl_ui_spotlight_container.c b/src/lib/elementary/efl_ui_spotlight_container.c index 9906864d7a..37ee165667 100644 --- a/src/lib/elementary/efl_ui_spotlight_container.c +++ b/src/lib/elementary/efl_ui_spotlight_container.c @@ -214,9 +214,7 @@ _efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Contai //set a view manager in case nothing is here if (!manager) { - Eo *plain; - plain = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj); - efl_ui_spotlight_manager_set(obj, plain); + efl_ui_spotlight_manager_set(obj, efl_new(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS)); } else { @@ -605,7 +603,10 @@ _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Cont if (pd->transition) { + EINA_SAFETY_ON_FALSE_RETURN(efl_ownable_get(pd->transition)); efl_parent_set(pd->transition, obj); + //the api indicates that the caller passes ownership to this function, so we need to unref here + efl_unref(pd->transition); //disable animation when not finalized yet, this help reducing the overhead of scheduling a animation that will not be displayed efl_ui_spotlight_manager_animation_enabled_set(pd->transition, efl_finalized_get(obj)); efl_ui_spotlight_manager_bind(pd->transition, obj, diff --git a/src/lib/elementary/efl_ui_spotlight_util.c b/src/lib/elementary/efl_ui_spotlight_util.c index 308b4f3eaa..c49ebd4d8c 100644 --- a/src/lib/elementary/efl_ui_spotlight_util.c +++ b/src/lib/elementary/efl_ui_spotlight_util.c @@ -12,7 +12,7 @@ typedef struct { EOLIAN static Efl_Ui_Spotlight_Container* _efl_ui_spotlight_util_stack_gen(Efl_Ui_Widget *parent) { - Efl_Ui_Spotlight_Manager *manager = efl_add(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS, parent); + Efl_Ui_Spotlight_Manager *manager = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS); return efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, parent, efl_ui_spotlight_manager_set(efl_added, manager)); } diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c index 7a39e6e940..6b5a79291d 100644 --- a/src/tests/elementary/efl_ui_test_spotlight.c +++ b/src/tests/elementary/efl_ui_test_spotlight.c @@ -209,7 +209,7 @@ _create_transition(void) { Eo *obj; - obj = efl_add(efl_ui_spotlight_manager_realized_class_get(), win); + obj = efl_new(efl_ui_spotlight_manager_realized_class_get()); efl_object_override(obj, &transition_tracker); return obj; --