From: Lars Ingebrigtsen Date: Tue, 12 Apr 2022 10:12:24 +0000 (+0200) Subject: Fix thinko in the anim cache X-Git-Tag: emacs-29.0.90~1931^2~638 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8e1c0054b3545863e41d51c95b69ab7fdb0cc61d;p=emacs.git Fix thinko in the anim cache * src/image.c (gif_load): Fix resetting the cache when we're out of sync. (anim_create_cache): Start from zero, not 1. --- diff --git a/src/image.c b/src/image.c index 38c3f1496aa..f6143f5b46e 100644 --- a/src/image.c +++ b/src/image.c @@ -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; } }