Subject: Re: bug#23431: 25.0.93; EWW hangs

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 03 May 2016 20:17:06 +0200

Does the following patch help?  It'll cache the metadata.

Doesn't make much difference on the test image for me.

diff --git a/lisp/image.el b/lisp/image.el
index 2ae642a..9c27664 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -698,14 +698,21 @@ image-multi-frame-p
 the number of frames (or sub-images) in the image and DELAY is the delay
 in seconds that the image specifies between each frame.  DELAY may be nil,
 in which case you might want to use `image-default-frame-delay'."
-  (when (fboundp 'image-metadata)
-    (let* ((metadata (image-metadata image))
-	   (images (plist-get metadata 'count))
-	   (delay (plist-get metadata 'delay)))
-      (when (and images (> images 1))
-	(and delay (or (not (numberp delay)) (< delay 0))
-	     (setq delay image-default-frame-delay))
-	(cons images delay)))))
+  (or (plist-get (cdr image) :image-metadata)
+      (when (fboundp 'image-metadata)
+        (let* ((metadata (image-metadata image))
+               (images (plist-get metadata 'count))
+               (delay (plist-get metadata 'delay))
+               (result
+                (and images
+                     (> images 1)
+                     (cons images
+                           (if (or (not (numberp delay))
+                                   (< delay 0))
+                               image-default-frame-delay
+                             delay)))))
+          (plist-put (cdr image) :image-metadata result)
+          result))))
 
 (defun image-animated-p (image)
   "Like `image-multi-frame-p', but returns nil if no delay is specified."

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no