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 c55e4a00e57f1bb57a0a2e6935267241f221b3c8
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 7 23:08:40 2026 -0600

    elementary: setting an empty exit code on a window unsets it
    
    eina_value_flush leaves the type of a basic value in place, so setting
    an empty value as the exit code of a window kept the old code: the
    window went on quitting the loop with it. The new value is now made
    first (it may be the one the window holds), the old one flushed, and
    the empty value assigned.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_win.c     | 12 +++++++-----
 src/tests/elementary/elm_test_win.c | 23 +++++++++++++++++++++++
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index e0532539a9..47dfde2dbe 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -6219,12 +6219,14 @@ _efl_ui_win_exit_on_close_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
 EOLIAN static void
 _efl_ui_win_exit_on_close_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const Eina_Value *exit_code)
 {
-   const Eina_Value_Type *type = eina_value_type_get(exit_code);
+   Eina_Value next = EINA_VALUE_EMPTY;
 
-   if (type)
-     eina_value_copy(exit_code, &sd->exit_on_close);
-   else
-     eina_value_flush(&sd->exit_on_close);
+   /* The new value is made first: exit_code may be the one we hold. And a
+    * flush leaves the type of a basic value in place, so what unsets is an
+    * empty value, not the flush. */
+   if (eina_value_type_get(exit_code) && !eina_value_copy(exit_code, &next)) return;
+   eina_value_flush(&sd->exit_on_close);
+   sd->exit_on_close = next;
 }
 
 /* Only for C API */
diff --git a/src/tests/elementary/elm_test_win.c b/src/tests/elementary/elm_test_win.c
index e90a31a4b6..e80a351616 100644
--- a/src/tests/elementary/elm_test_win.c
+++ b/src/tests/elementary/elm_test_win.c
@@ -207,6 +207,28 @@ EFL_START_TEST(elm_win_policy_quit_last_window_hidden)
 }
 EFL_END_TEST
 
+EFL_START_TEST(elm_win_test_exit_on_close_unset)
+{
+   Eo *win = win_add(NULL, "win", ELM_WIN_BASIC);
+   Eina_Value val = eina_value_int_init(66);
+   int code = 0;
+
+   ck_assert(!eina_value_type_get(efl_ui_win_exit_on_close_get(win)));
+   efl_ui_win_exit_on_close_set(win, &val);
+   ck_assert(eina_value_int_get(efl_ui_win_exit_on_close_get(win), &code));
+   ck_assert_int_eq(code, 66);
+
+   /* what the window returns can be set back, and is not lost doing it */
+   efl_ui_win_exit_on_close_set(win, efl_ui_win_exit_on_close_get(win));
+   ck_assert(eina_value_int_get(efl_ui_win_exit_on_close_get(win), &code));
+   ck_assert_int_eq(code, 66);
+
+   /* an empty value unsets it: the old one must not stay */
+   efl_ui_win_exit_on_close_set(win, &EINA_VALUE_EMPTY);
+   ck_assert(!eina_value_type_get(efl_ui_win_exit_on_close_get(win)));
+}
+EFL_END_TEST
+
 EFL_START_TEST(elm_win_test_exit_on_close)
 {
    Eo *win = win_add(NULL, "win", ELM_WIN_BASIC);
@@ -484,6 +506,7 @@ void elm_test_win(TCase *tc)
    tcase_add_test(tc, elm_atspi_component_screen_position);
    tcase_add_test(tc, elm_win_policy_quit_last_window_hidden);
    tcase_add_test(tc, elm_win_test_exit_on_close);
+   tcase_add_test(tc, elm_win_test_exit_on_close_unset);
    tcase_add_test(tc, elm_win_test_app_exit_on_windows_close);
    tcase_add_test(tc, efl_ui_win_multi_touch_inputs);
    tcase_add_test(tc, elm_win_test_rotation);

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

Reply via email to