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 c4494afede2741a36a67bad19fb0bbde5fcbe7a3
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 8 22:28:54 2026 -0600

    elementary: property_bind with no property takes the binding away
    
    The widget factory already calls efl_ui_property_bind(widget, key, NULL)
    to let go of what it bound, but the call made a new binding to a NULL
    model property (a NULL key in the lookup table). It now removes the
    binding of the part and key, and adds none.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_widget.c               |  3 +++
 src/tests/elementary/efl_ui_test_property_bind.c | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index 600e6f3e52..8db447f20c 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -6169,6 +6169,9 @@ _efl_ui_property_bind(Eo *widget, Eo *target, Efl_Ui_Widget_Data *pd,
    // reuses, and the old binding would otherwise keep updating it as well
    _efl_ui_property_unbind(pd, part, key);
 
+   // No property to follow: the binding is gone, which is all that was asked.
+   if (!property) return 0;
+
    prop = calloc(1, sizeof (Efl_Ui_Property_Bound));
    if (!prop) return ENOMEM;
    prop->part = eina_stringshare_add(part);
diff --git a/src/tests/elementary/efl_ui_test_property_bind.c b/src/tests/elementary/efl_ui_test_property_bind.c
index 4ad561f14e..f4bbdcde6e 100644
--- a/src/tests/elementary/efl_ui_test_property_bind.c
+++ b/src/tests/elementary/efl_ui_test_property_bind.c
@@ -630,6 +630,26 @@ EFL_START_TEST(rebinding_a_key_replaces_the_binding)
 }
 EFL_END_TEST
 
+// Binding a key to no property takes the binding away, and adds none.
+EFL_START_TEST(binding_to_no_property_unbinds)
+{
+   Eo *win = _window();
+   Eo *model = _model_new("t", eina_value_string_new("first"));
+   Eo *txt;
+
+   txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
+                 efl_ui_view_model_set(efl_added, model),
+                 efl_ui_property_bind(efl_added, "text", "t"));
+   ck_assert_str_eq(efl_text_get(txt), "first");
+
+   ck_assert_int_eq(efl_ui_property_bind(txt, "text", NULL), 0);
+
+   _model_set(model, "t", eina_value_string_new("second"));
+   ck_assert_str_eq(efl_text_get(txt), "first");
+   efl_unref(model);
+}
+EFL_END_TEST
+
 // Binding a part again replaces what it was bound to: it follows the new
 // property only, and the old one has no hold on it any more.
 EFL_START_TEST(rebinding_a_layout_part_replaces_the_binding)
@@ -746,6 +766,7 @@ efl_ui_test_property_bind(TCase *tc)
    tcase_add_test(tc, rebinding_a_key_replaces_the_binding);
    tcase_add_test(tc, rebinding_a_layout_part_replaces_the_binding);
    tcase_add_test(tc, rebinding_one_of_several_parts_keeps_the_others);
+   tcase_add_test(tc, binding_to_no_property_unbinds);
    tcase_add_test(tc, textbox_model_change_does_not_loop);
    tcase_add_test(tc, textbox_typing_in_the_middle_keeps_the_cursor);
    tcase_add_test(tc, textbox_typing_at_the_start_keeps_the_cursor);

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

Reply via email to