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
This commit is contained in:
Marcel Hollerbach 2019-07-12 18:39:07 +02:00
parent 670b7b4a83
commit 6d0b0baf9b
4 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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,

View File

@ -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));
}

View File

@ -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;