# HG changeset patch # User nadvornik # Date 1254139475 0 # Node ID 680bcf82eaffccd1426ae7b017c37070bf29def7 # Parent caf0e4b8319db3c7923719587bfe2be7a0bdf040 do not cache incomplete thumbnails diff -r caf0e4b8319d -r 680bcf82eaff src/thumb_standard.c --- 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 &&