Mercurial > geeqie
changeset 1762:680bcf82eaff
do not cache incomplete thumbnails
author | nadvornik |
---|---|
date | Mon, 28 Sep 2009 12:04:35 +0000 |
parents | caf0e4b8319d |
children | 140b73f094c5 |
files | src/thumb_standard.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/thumb_standard.c Mon Sep 28 09:57:06 2009 +0000 +++ b/src/thumb_standard.c Mon Sep 28 12:04:35 2009 +0000 @@ -419,6 +419,7 @@ if (sw > cache_w || sh > cache_h || shrunk) { gint thumb_w, thumb_h; + struct stat st; if (pixbuf_scale_aspect(cache_w, cache_h, sw, sh, &thumb_w, &thumb_h)) @@ -432,7 +433,14 @@ g_object_ref(G_OBJECT(pixbuf_thumb)); } - thumb_loader_std_save(tl, pixbuf_thumb); + /* do not save the thumbnail if the source file has changed meanwhile - + the thumbnail is most probably broken */ + if (stat_utf8(tl->fd->path, &st) && + tl->source_mtime == st.st_mtime && + tl->source_size == st.st_size) + { + thumb_loader_std_save(tl, pixbuf_thumb); + } } } else if (tl->cache_hit &&