comparison src/thumb_standard.c @ 1725:dc065c04a688

do not cache incomplete thumbnails
author nadvornik
date Mon, 28 Sep 2009 12:04:35 +0000
parents 7c4a87f98cc9
children
comparison
equal deleted inserted replaced
1724:5276dabe836f 1725:dc065c04a688
417 } 417 }
418 418
419 if (sw > cache_w || sh > cache_h || shrunk) 419 if (sw > cache_w || sh > cache_h || shrunk)
420 { 420 {
421 gint thumb_w, thumb_h; 421 gint thumb_w, thumb_h;
422 struct stat st;
422 423
423 if (pixbuf_scale_aspect(cache_w, cache_h, sw, sh, 424 if (pixbuf_scale_aspect(cache_w, cache_h, sw, sh,
424 &thumb_w, &thumb_h)) 425 &thumb_w, &thumb_h))
425 { 426 {
426 pixbuf_thumb = gdk_pixbuf_scale_simple(pixbuf, thumb_w, thumb_h, 427 pixbuf_thumb = gdk_pixbuf_scale_simple(pixbuf, thumb_w, thumb_h,
430 { 431 {
431 pixbuf_thumb = pixbuf; 432 pixbuf_thumb = pixbuf;
432 g_object_ref(G_OBJECT(pixbuf_thumb)); 433 g_object_ref(G_OBJECT(pixbuf_thumb));
433 } 434 }
434 435
435 thumb_loader_std_save(tl, pixbuf_thumb); 436 /* do not save the thumbnail if the source file has changed meanwhile -
437 the thumbnail is most probably broken */
438 if (stat_utf8(tl->fd->path, &st) &&
439 tl->source_mtime == st.st_mtime &&
440 tl->source_size == st.st_size)
441 {
442 thumb_loader_std_save(tl, pixbuf_thumb);
443 }
436 } 444 }
437 } 445 }
438 else if (tl->cache_hit && 446 else if (tl->cache_hit &&
439 tl->cache_local && !tl->thumb_path_local) 447 tl->cache_local && !tl->thumb_path_local)
440 { 448 {