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 e1f435671c184ff5aede0d4560811cfa284876f6
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Nov 10 22:31:07 2026 -0600
elementary: exact_model: drop a stopped removal's stale height record
The height of a removed row is kept for the listeners of the event,
keyed by the address of the event, which is on the stack and is the same
for the next removal. A listener that stopped CHILD_REMOVED left the
record (never let go of by the last listener), and the next removal of a
row nobody measured was given the height of the one before. A removal
now lets go of what it finds at its own address first: two events that
are being told are never at the same one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_exact_model.c | 9 +++-
src/tests/elementary/efl_ui_model.c | 74 +++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/src/lib/elementary/efl_ui_exact_model.c b/src/lib/elementary/efl_ui_exact_model.c
index ae8bcccc7c..5cfe9c9624 100644
--- a/src/lib/elementary/efl_ui_exact_model.c
+++ b/src/lib/elementary/efl_ui_exact_model.c
@@ -34,7 +34,9 @@ struct _Efl_Ui_Exact_Model_Data
// how many times the sizes were all forgotten
// The event that told of it is what says whose it is, so that one that was
// stopped before the last listener, and a removal told from a listener of
- // another, do not give what is another row's. The one that was being told
+ // another, do not give what is another row's. (An event is at the address
+ // of an older one that is over, which is why a new removal first lets go of
+ // what it finds at its address.) The one that was being told
// when another began is kept (the removals are not nested more than that).
struct {
const void *event;
@@ -593,6 +595,11 @@ _efl_ui_exact_model_shift(Efl_Ui_Exact_Model_Data *root, unsigned int index, Ein
if (!added)
{
+ // Two events that are being told are not at the same address, so what was kept for
+ // one at this address is of an event that was stopped before the last listener,
+ // and was never let go of: it is not this row's, and not an outer one either
+ if (root->removed.event == event) memset(&root->removed, 0, sizeof (root->removed));
+ if (root->outer.event == event) memset(&root->outer, 0, sizeof (root->outer));
// (whatever the last one told is of no use to this one, and what it was told of is kept)
root->outer = root->removed;
root->removed.measured = EINA_FALSE;
diff --git a/src/tests/elementary/efl_ui_model.c b/src/tests/elementary/efl_ui_model.c
index 119e754017..5ae2ac9d38 100644
--- a/src/tests/elementary/efl_ui_model.c
+++ b/src/tests/elementary/efl_ui_model.c
@@ -1635,6 +1635,79 @@ EFL_START_TEST(efl_ui_average_model_remove_nested)
}
EFL_END_TEST
+static void
+_stop_removal(void *data, const Efl_Event *ev)
+{
+ Nested_Removal *nr = data;
+
+ if (nr->done) return;
+ nr->done = EINA_TRUE;
+ efl_event_callback_stop(ev->object);
+}
+
+// A listener stops the removal of a row that was measured before the Average_Model is told of
+// it (and what the Exact_Model kept of that row is never let go of by the end of the event). The
+// removal of a row that was not measured, that comes next from the same place (the event is
+// at the same address), does not take the height of the one before out of the average.
+EFL_START_TEST(efl_ui_average_model_remove_after_stopped)
+{
+ Efl_Model *base_model, *model;
+ Many_Rows *many = calloc(1, sizeof (Many_Rows));
+ Many_Rows *base_rows = calloc(1, sizeof (Many_Rows));
+ Nested_Removal nr = { 0 };
+ unsigned int i, loops;
+
+ base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
+ for (i = 0; i < 4; i++)
+ {
+ efl_model_child_add(base_model);
+ }
+ model = efl_add_ref(EFL_UI_AVERAGE_MODEL_CLASS, efl_main_loop_get(),
+ efl_ui_view_model_set(efl_added, base_model));
+ ck_assert(!!model);
+ eina_future_then(efl_model_children_slice_get(model, 0, 4), _many_rows_then, many, NULL);
+ eina_future_then(efl_model_children_slice_get(base_model, 0, 4), _many_rows_then, base_rows, NULL);
+ for (loops = 0; (loops < 50) && (many->count < 4 || base_rows->count < 4); loops++)
+ {
+ ecore_main_loop_iterate();
+ }
+ ck_assert_uint_eq(many->count, 4);
+ ck_assert_uint_eq(base_rows->count, 4);
+
+ _uint_set(many->rows[0], "self.height", 10);
+ _uint_set(many->rows[1], "self.height", 20);
+ for (loops = 0; loops < 8; loops++)
+ {
+ ecore_main_loop_iterate();
+ }
+ ck_assert_uint_eq(_property_uint_expected(model, "total.height"), 60);
+
+ efl_event_callback_priority_add(model, EFL_MODEL_EVENT_CHILD_REMOVED, -150, _stop_removal, &nr);
+ efl_model_child_del(base_model, base_rows->rows[0]);
+ ck_assert(nr.done);
+ efl_event_callback_del(model, EFL_MODEL_EVENT_CHILD_REMOVED, _stop_removal, &nr);
+
+ // (the Average_Model was not told of that one: it still has the 30 over 2 seen rows)
+ efl_model_child_del(base_model, base_rows->rows[3]);
+ for (loops = 0; loops < 8; loops++)
+ {
+ ecore_main_loop_iterate();
+ }
+ // The row that was not measured took nothing out: 30 over 2, for the 2 rows that are left
+ ck_assert_uint_eq(_property_uint_expected(model, "total.height"), 30);
+
+ for (i = 0; i < 4; i++)
+ {
+ efl_unref(many->rows[i]);
+ efl_unref(base_rows->rows[i]);
+ }
+ free(many);
+ free(base_rows);
+ efl_unref(model);
+ efl_unref(base_model);
+}
+EFL_END_TEST
+
void
efl_ui_model(TCase *tc)
{
@@ -1665,4 +1738,5 @@ efl_ui_model(TCase *tc)
tcase_add_test(tc, efl_ui_exact_model_destroyed);
tcase_add_test(tc, efl_ui_average_model_forgotten_in_set);
tcase_add_test(tc, efl_ui_average_model_remove_nested);
+ tcase_add_test(tc, efl_ui_average_model_remove_after_stopped);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.