bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2a970046bc6355af59e0b4c0f7d44e0b44d764bb

commit 2a970046bc6355af59e0b4c0f7d44e0b44d764bb
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Fri Jul 12 19:33:31 2019 +0200

    efl_ui_spotlight_container: mirror the behavior of view_manager
    
    setting the parent here is usefull, as we can forgot about this object
    then, and do not have to free the object by hand.
    
    Differential Revision: https://phab.enlightenment.org/D9305
---
 src/bin/elementary/test_ui_spotlight.c          | 2 +-
 src/lib/elementary/efl_ui_spotlight_container.c | 4 ++++
 src/tests/elementary/efl_ui_test_spotlight.c    | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/bin/elementary/test_ui_spotlight.c 
b/src/bin/elementary/test_ui_spotlight.c
index bcb6fbbd3e..ff0cbdd6f5 100644
--- a/src/bin/elementary/test_ui_spotlight.c
+++ b/src/bin/elementary/test_ui_spotlight.c
@@ -347,7 +347,7 @@ indicator_icon_btn_cb(void *data, const Efl_Event *ev 
EINA_UNUSED)
 {
    Params *params = data;
 
-   params->indicator = efl_add(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS, 
params->spotlight);
+   params->indicator = efl_new(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS);
    efl_ui_spotlight_indicator_set(params->spotlight, params->indicator);
 }
 
diff --git a/src/lib/elementary/efl_ui_spotlight_container.c 
b/src/lib/elementary/efl_ui_spotlight_container.c
index 37ee165667..45afd99b1b 100644
--- a/src/lib/elementary/efl_ui_spotlight_container.c
+++ b/src/lib/elementary/efl_ui_spotlight_container.c
@@ -637,6 +637,10 @@ _efl_ui_spotlight_container_indicator_set(Eo *obj, 
Efl_Ui_Spotlight_Container_Da
    pd->indicator = indicator;
    if (pd->indicator)
      {
+        EINA_SAFETY_ON_FALSE_RETURN(efl_ownable_get(pd->indicator));
+        efl_parent_set(pd->indicator, obj);
+        //the api indicates that the caller passes ownership to this function, 
so we need to unref here
+        efl_unref(pd->indicator);
         efl_ui_spotlight_indicator_bind(pd->indicator, obj);
         if (pd->position != -1)
           efl_ui_spotlight_indicator_position_update(pd->indicator, 
pd->position);
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c 
b/src/tests/elementary/efl_ui_test_spotlight.c
index 6b5a79291d..0bad5c362f 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -81,7 +81,7 @@ _create_indicator(void)
 {
    Eo *obj;
 
-   obj = efl_add(efl_ui_spotlight_indicator_realized_class_get(), win);
+   obj = efl_new(efl_ui_spotlight_indicator_realized_class_get());
    efl_object_override(obj, &indicator_tracker);
 
    return obj;

-- 


Reply via email to