summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2020-05-21 18:36:10 +0900
committerSangHyeon Jade Lee <sh10233.lee@samsung.com>2020-05-21 18:37:27 +0900
commitc493e80c216c71373bfa4898841ffaca32dd18a9 (patch)
treef2e2d06c4bc25998ec5d69f340d5ffbbcf542493
parentf9a108c51a6a7f013df8dfd8c7735e1fa6d7dacc (diff)
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
-rw-r--r--src/lib/elementary/elm_gengrid.c9
-rw-r--r--src/lib/elementary/elm_genlist.c9
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)
165 /* does not exist if cache item has just been reused */ 165 /* does not exist if cache item has just been reused */
166 if (itc->base_view) 166 if (itc->base_view)
167 { 167 {
168 Evas_Object *view = itc->base_view;
168 efl_wref_del(itc->base_view, &itc->base_view); 169 efl_wref_del(itc->base_view, &itc->base_view);
169 efl_del(itc->base_view); 170 efl_del(view);
171 itc->base_view = NULL;
170 } 172 }
171 eina_stringshare_del(itc->item_style); 173 eina_stringshare_del(itc->item_style);
172 EINA_LIST_FREE(itc->contents, c) 174 EINA_LIST_FREE(itc->contents, c)
@@ -1494,7 +1496,10 @@ _item_unrealize_cb(Elm_Gen_Item *it)
1494 Evas_Object *c; 1496 Evas_Object *c;
1495 if (!_item_cache_add(it, _content_cache_add(it, &cache))) 1497 if (!_item_cache_add(it, _content_cache_add(it, &cache)))
1496 { 1498 {
1497 ELM_SAFE_FREE(VIEW(it), evas_object_del); 1499 Evas_Object *view = VIEW(it);
1500 efl_wref_del(VIEW(it), &VIEW(it));
1501 ELM_SAFE_FREE(view, evas_object_del);
1502 VIEW(it) = NULL;
1498 ELM_SAFE_FREE(it->spacer, evas_object_del); 1503 ELM_SAFE_FREE(it->spacer, evas_object_del);
1499 EINA_LIST_FREE(cache, c) 1504 EINA_LIST_FREE(cache, c)
1500 evas_object_del(c); 1505 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)
1555 /* does not exist if cache item has just been reused */ 1555 /* does not exist if cache item has just been reused */
1556 if (itc->base_view) 1556 if (itc->base_view)
1557 { 1557 {
1558 Evas_Object *view = itc->base_view;
1558 efl_wref_del(itc->base_view, &itc->base_view); 1559 efl_wref_del(itc->base_view, &itc->base_view);
1559 efl_del(itc->base_view); 1560 efl_del(view);
1561 itc->base_view = NULL;
1560 } 1562 }
1561 itc->item_class = NULL; 1563 itc->item_class = NULL;
1562 EINA_LIST_FREE(itc->contents, c) 1564 EINA_LIST_FREE(itc->contents, c)
@@ -5386,7 +5388,10 @@ _item_unrealize(Elm_Gen_Item *it)
5386 5388
5387 if (!_item_cache_add(it, _content_cache_add(it, &cache))) 5389 if (!_item_cache_add(it, _content_cache_add(it, &cache)))
5388 { 5390 {
5389 ELM_SAFE_FREE(VIEW(it), efl_del); 5391 Evas_Object *view = VIEW(it);
5392 efl_wref_del(VIEW(it), &VIEW(it));
5393 ELM_SAFE_FREE(view, efl_del);
5394 VIEW(it) = NULL;
5390 it->callbacks = EINA_FALSE; 5395 it->callbacks = EINA_FALSE;
5391 ELM_SAFE_FREE(it->spacer, evas_object_del); 5396 ELM_SAFE_FREE(it->spacer, evas_object_del);
5392 EINA_LIST_FREE(cache, c) 5397 EINA_LIST_FREE(cache, c)