stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=e81c32608865e16272205880ddb6024329af6790
commit e81c32608865e16272205880ddb6024329af6790 Author: Hosang Kim <hosang12....@samsung.com> Date: Thu May 21 18:36:10 2020 +0900 elm_genlist/elm_gengrid: fix memory leak caused by efl_wref_del. Summary: efl_wref_del makes pointer to NULL. So we should copy pointer before efl_wref_del is called. Reviewers: SanghyeonLee, cedric Reviewed By: SanghyeonLee Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11866 --- src/lib/elementary/elm_gengrid.c | 9 +++++++-- src/lib/elementary/elm_genlist.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index 707272be55..8446db8cab 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -165,8 +165,10 @@ _item_cache_free(Item_Cache *itc) /* does not exist if cache item has just been reused */ if (itc->base_view) { + Evas_Object *view = itc->base_view; efl_wref_del(itc->base_view, &itc->base_view); - efl_del(itc->base_view); + efl_del(view); + itc->base_view = NULL; } eina_stringshare_del(itc->item_style); EINA_LIST_FREE(itc->contents, c) @@ -1494,7 +1496,10 @@ _item_unrealize_cb(Elm_Gen_Item *it) Evas_Object *c; if (!_item_cache_add(it, _content_cache_add(it, &cache))) { - ELM_SAFE_FREE(VIEW(it), evas_object_del); + Evas_Object *view = VIEW(it); + efl_wref_del(VIEW(it), &VIEW(it)); + ELM_SAFE_FREE(view, evas_object_del); + VIEW(it) = NULL; ELM_SAFE_FREE(it->spacer, evas_object_del); EINA_LIST_FREE(cache, c) evas_object_del(c); diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index 5da1517fc8..6866b14965 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -1555,8 +1555,10 @@ _item_cache_free(Item_Cache *itc) /* does not exist if cache item has just been reused */ if (itc->base_view) { + Evas_Object *view = itc->base_view; efl_wref_del(itc->base_view, &itc->base_view); - efl_del(itc->base_view); + efl_del(view); + itc->base_view = NULL; } itc->item_class = NULL; EINA_LIST_FREE(itc->contents, c) @@ -5386,7 +5388,10 @@ _item_unrealize(Elm_Gen_Item *it) if (!_item_cache_add(it, _content_cache_add(it, &cache))) { - ELM_SAFE_FREE(VIEW(it), efl_del); + Evas_Object *view = VIEW(it); + efl_wref_del(VIEW(it), &VIEW(it)); + ELM_SAFE_FREE(view, efl_del); + VIEW(it) = NULL; it->callbacks = EINA_FALSE; ELM_SAFE_FREE(it->spacer, evas_object_del); EINA_LIST_FREE(cache, c) --