]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix thinko in the anim cache
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 12 Apr 2022 10:12:24 +0000 (12:12 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 12 Apr 2022 10:12:24 +0000 (12:12 +0200)
* src/image.c (gif_load): Fix resetting the cache when we're out
of sync.
(anim_create_cache): Start from zero, not 1.

src/image.c

index 38c3f1496aa01d377200449ef0519180fd3c8c91..f6143f5b46e8ca5b1fc0ee3433ac2b76006d5c2a 100644 (file)
@@ -2847,7 +2847,7 @@ anim_create_cache (Lisp_Object spec)
   cache->handle = NULL;
   cache->temp = NULL;
 
-  cache->index = 0;
+  cache->index = -1;
   cache->next = NULL;
   cache->spec = spec;
   return cache;
@@ -8825,15 +8825,14 @@ gif_load (struct frame *f, struct image *img)
     {
       /* If this is an animated image, create a cache for it.  */
       cache = anim_get_animation_cache (img->spec);
+      /* We have an old cache entry, so use it.  */
       if (cache->handle)
        {
-         /* We have an old cache entry, and it looks correct, so use
-            it.  */
-         if (cache->index == idx - 1)
-           {
-             gif = cache->handle;
-             pixmap = cache->temp;
-           }
+         gif = cache->handle;
+         pixmap = cache->temp;
+         /* We're out of sync, so start from the beginning.  */
+         if (cache->index != idx - 1)
+           cache->index = -1;
        }
     }