evas_image_main: fix memory leak 08/123008/2
authorJiyoun Park <jy0703.park@samsung.com>
Fri, 6 Jan 2017 06:45:27 +0000 (15:45 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Tue, 4 Apr 2017 07:51:47 +0000 (16:51 +0900)
In gl engine, image objects try to unload image's pixel data after creating or updating the texture.
but image entry's reference is still 1, it is added to the pending_unloads list,
and it is cleaned when evas render function.

If elm image use preload feature, preload_done flag is true, so this image data cannot be removed from
pending_unloads list, it cause memory leak.

I think it is better to free image's pixel data in evas_cache_image_unload_data,
(not add to the pending_unloads list)
but it it complicated to modify.

so I'll remove the code to check preload_done flag in  evas_common_rgba_pending_unloads_cleanup function.
this flag check was added because of gl preloading, but now gl preloading feature is disabled.
this flag is related with https://phab.enlightenment.org/D2823

I tested photocam, but crash doesn't occur anymore, even though removing flag check.

Change-Id: I0996cd5a35979535030c782a3b70afeb1c79365a

src/lib/evas/common/evas_image_main.c

index 5cf5335..53d2121 100644 (file)
@@ -408,7 +408,7 @@ evas_common_rgba_pending_unloads_cleanup(void)
 
    EINA_LIST_FOREACH_SAFE(pending_unloads, l, l_next, ie)
      {
-        if ((ie->need_unload) && (!ie->preload) && (!ie->flags.preload_done))
+        if ((ie->need_unload) && (!ie->preload))
           {
              evas_common_rgba_image_unload_real(ie);
              pending_unloads = eina_list_remove_list(pending_unloads, l);