evas_image : fix unloads cleanup logic
authorHosang Kim <hosang12.kim@samsung.com>
Thu, 16 Jul 2015 11:07:39 +0000 (20:07 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 16 Jul 2015 11:15:12 +0000 (20:15 +0900)
Summary:
Now Evas gl preload feature is disabled.
But if it is turned on, memory crash occurs.
Because evas_gl_common_texture_upload is not excuted immediately.

Test Plan: EVAS_GL_PRELOAD=1 ELM_ENGINE=gl elementary_test -to "photocam"

Reviewers: raster, cedric, woohyun, seoz, Hermet, singh.amitesh, jpeg

Subscribers: jpeg, cedric

Differential Revision: https://phab.enlightenment.org/D2823

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
src/lib/evas/common/evas_image_main.c

index 10966fd..ce07dab 100644 (file)
@@ -392,11 +392,16 @@ EAPI void
 evas_common_rgba_pending_unloads_cleanup(void)
 {
    Image_Entry *ie;
+   Eina_List *l;
+   Eina_List *l_next;
 
-   EINA_LIST_FREE(pending_unloads, ie)
+   EINA_LIST_FOREACH_SAFE(pending_unloads, l, l_next, ie)
      {
-        if ((ie->need_unload) && (!ie->preload))
-          evas_common_rgba_image_unload_real(ie);
+        if ((ie->need_unload) && (!ie->preload) && (!ie->flags.preload_done))
+          {
+             evas_common_rgba_image_unload_real(ie);
+             pending_unloads = eina_list_remove_list(pending_unloads, l);
+          }
      }
 }