bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/apps/extra.git/commit/?id=c32bfdb14494643ed2cb09ff2b2087c7b8228173

commit c32bfdb14494643ed2cb09ff2b2087c7b8228173
Author: Marcel Hollerbach <[email protected]>
Date:   Tue Jan 31 20:18:05 2017 +0100

    extra: if a image cannot be set delete the file and redownload it
    
    this should fix cases where people dont see complete images because they
    are corrupted. For example because the app was closed when then image
    was not fully downloaded.
---
 src/bin/extra_util.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/bin/extra_util.c b/src/bin/extra_util.c
index 7753b7c..5c6a1d0 100644
--- a/src/bin/extra_util.c
+++ b/src/bin/extra_util.c
@@ -155,7 +155,11 @@ _small_preview_done_cb(void *data)
    preview = p->acc.preview_get(p->data);
    if (preview)
      {
-        elm_image_file_set(p->image , preview, NULL);
+        if (!elm_image_file_set(p->image , preview, NULL))
+          {
+             //the download failed, do nothing here, we likly will run into 
the same problem. And we should not spam our download requests
+             ecore_file_remove(preview);
+          }
         evas_object_show(p->image);
         free(preview);
      }
@@ -195,10 +199,19 @@ 
extra_ui_small_preview_new(Extra_Ui_Small_Preview_Accessor acc, Evas_Object *par
    preview = acc.preview_get(data);
    if (preview)
      {
-        elm_image_file_set(small->image, preview, NULL);
-        free(preview);
+        if (!elm_image_file_set(small->image, preview, NULL))
+          {
+             ecore_file_remove(preview);
+             free(preview);
+             preview = NULL;
+          }
+        else
+          {
+             free(preview);
+          }
      }
-   else
+
+   if (!preview)
      {
         small->p.data = small;
         small->p.done_cb = _small_preview_done_cb;

-- 


Reply via email to