This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit eb2627b281e3ef29f25ec9346754985b82a0b1b7
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 8 01:01:48 2026 -0600

    elementary: a spotlight container ends the manager it replaces
    
    Setting no manager made the plain stand-in first, overwriting the
    pointer to the manager that was set, then deleted the stand-in: the old
    manager leaked and the container was left with none. The old manager is
    released first now, and the new one, or a plain one for none, is taken
    over as any other manager is.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_spotlight_container.c |  9 ++++++---
 src/tests/elementary/efl_ui_test_spotlight.c    | 27 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/lib/elementary/efl_ui_spotlight_container.c b/src/lib/elementary/efl_ui_spotlight_container.c
index 131f228562..5d89f37550 100644
--- a/src/lib/elementary/efl_ui_spotlight_container.c
+++ b/src/lib/elementary/efl_ui_spotlight_container.c
@@ -654,17 +654,20 @@ _pos_updated(void *data, const Efl_Event *event)
 EOLIAN static void
 _efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Manager *transition)
 {
-   if (!transition)
-     pd->transition = efl_add(EFL_UI_SPOTLIGHT_PLAIN_MANAGER_CLASS, obj);
-   else
+   if (transition)
      EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_SPOTLIGHT_MANAGER_CLASS));
 
+   // the manager that is there goes first, then the new one (a plain one when
+   // none is given) is taken over the same way
    if (pd->transition)
      {
         efl_ui_spotlight_manager_bind(pd->transition, NULL);
         efl_del(pd->transition);
+        pd->transition = NULL;
      }
 
+   if (!transition)
+     transition = efl_new(EFL_UI_SPOTLIGHT_PLAIN_MANAGER_CLASS);
    pd->transition = transition;
 
    if (pd->transition)
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c
index 2166702797..81f83426fc 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -665,6 +665,32 @@ EFL_START_TEST (efl_ui_spotlight_animated_transition)
 }
 EFL_END_TEST
 
+static void
+_manager_del(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   *(Eina_Bool *)data = ""
+}
+
+// Setting no manager ends the one that was set, and a plain one stands in.
+EFL_START_TEST (efl_ui_spotlight_manager_unset)
+{
+   Eina_Bool gone = EINA_FALSE;
+   Eo *manager = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS);
+
+   efl_event_callback_add(manager, EFL_EVENT_DEL, _manager_del, &gone);
+   efl_ui_spotlight_manager_set(container, manager);
+   ck_assert_ptr_eq(efl_ui_spotlight_manager_get(container), manager);
+   ck_assert_int_eq(efl_ref_count(manager), 1);
+
+   efl_ui_spotlight_manager_set(container, NULL);
+   ck_assert(gone);
+   ck_assert_ptr_eq(efl_ui_spotlight_manager_get(container), NULL);
+   // (a manager stands in: the container still works)
+   efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
+   ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_FALSE);
+}
+EFL_END_TEST
+
 EFL_START_TEST (efl_ui_spotlight_min_max_sizing)
 {
    Efl_Ui_Button *btn0, *btn1;
@@ -743,5 +769,6 @@ void efl_ui_test_spotlight(TCase *tc)
    tcase_add_test(tc, efl_ui_spotlight_test_pop2);
    tcase_add_test(tc, efl_ui_spotlight_test_pop3);
    tcase_add_test(tc, efl_ui_spotlight_animated_transition);
+   tcase_add_test(tc, efl_ui_spotlight_manager_unset);
    tcase_add_test(tc, efl_ui_spotlight_min_max_sizing);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to