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 9953b3c74884daafa03209a5d7cdcbe1c76528e3
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Nov 12 18:03:34 2026 -0600
elementary: collection views release their factory and scroll connector
Efl.Ui.Collection_View took a reference on its factory in factory_set
and never gave it back, so the factory, every factory bound to it and
whatever they cache outlived the view and its window: three factory
objects per list view. It also, like Efl.Ui.Collection, bound a scroll
connector and never unbound it.
On invalidate, once every entity went back to the factory, drop the
"selected" binding factory_set added and the reference; unbind the
scroll connector in both classes.
The test checks the factory is back to its owner's reference once the
view is deleted (2 before this change).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_collection.c | 2 ++
src/lib/elementary/efl_ui_collection_view.c | 8 +++++++
src/tests/elementary/efl_ui_test_collection_view.c | 27 ++++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c
index cc371558d9..06a3352704 100644
--- a/src/lib/elementary/efl_ui_collection.c
+++ b/src/lib/elementary/efl_ui_collection.c
@@ -446,6 +446,8 @@ _efl_ui_collection_efl_object_invalidate(Eo *obj, Efl_Ui_Collection_Data *pd EIN
while(pd->items)
efl_del(pd->items->data);
+ efl_ui_scroll_connector_unbind(obj);
+
// pan is given to edje, which reparents it, which forces us to manually deleting it
efl_del(pd->pan);
diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index a101547f15..d85b0135fe 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -2736,6 +2736,14 @@ _efl_ui_collection_view_efl_object_invalidate(Eo *obj,
_all_cleanup(obj, pd);
+ /* Every entity went back to the factory above: the view has no further
+ * use for it, and the reference it took in factory_set is the one thing
+ * keeping it, and every factory bound to it, alive past its owner. */
+ if (pd->factory) efl_ui_property_bind(pd->factory, "selected", NULL);
+ efl_replace(&pd->factory, NULL);
+
+ efl_ui_scroll_connector_unbind(obj);
+
//pd pan is given to edje, which reparents it, which forces us to manually deleting it
if (pd->pan)
efl_del(pd->pan);
diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c
index 2c9e555ea1..c75cd3a6e3 100644
--- a/src/tests/elementary/efl_ui_test_collection_view.c
+++ b/src/tests/elementary/efl_ui_test_collection_view.c
@@ -2504,6 +2504,32 @@ EFL_START_TEST(test_efl_ui_collection_view_average_model_grid_prepend)
}
EFL_END_TEST
+// A view holds on to its factory only while it lives: once it is gone the
+// factory is back to the references its owner keeps, so the factory and every
+// factory bound to it go away with their owner.
+EFL_START_TEST(efl_ui_collection_view_lets_go_of_its_factory)
+{
+ Efl_Ui_Win *win;
+ Efl_Ui_Factory *fl;
+ Efl_Ui_Collection_View *cv;
+
+ win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ /* A factory needs a loop to live on: the window owns it. */
+ fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win,
+ efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS));
+ ck_assert_int_eq(efl_ref_count(fl), 1);
+
+ cv = efl_add(EFL_UI_LIST_VIEW_CLASS, win,
+ efl_ui_collection_view_factory_set(efl_added, fl),
+ efl_ui_view_model_set(efl_added, _make_model(win)));
+ efl_content_set(win, cv);
+ get_me_to_those_events(cv);
+
+ efl_del(cv);
+ ck_assert_int_eq(efl_ref_count(fl), 1);
+}
+EFL_END_TEST
+
void efl_ui_test_collection_view(TCase *tc)
{
tcase_add_test(tc, test_efl_ui_collection_view_basic);
@@ -2542,4 +2568,5 @@ void efl_ui_test_collection_view(TCase *tc)
tcase_add_test(tc, test_efl_ui_collection_view_grid_remove_fetches_nothing);
tcase_add_test(tc, test_efl_ui_collection_view_average_model_estimates);
tcase_add_test(tc, test_efl_ui_collection_view_average_model_grid_prepend);
+ tcase_add_test(tc, efl_ui_collection_view_lets_go_of_its_factory);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.