emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116561: * lisp/image.el (image-animate, image-anima


From: Glenn Morris
Subject: [Emacs-diffs] trunk r116561: * lisp/image.el (image-animate, image-animate-timeout): Stop animating images
Date: Tue, 25 Feb 2014 21:59:17 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116561
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16878
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2014-02-25 16:59:14 -0500
message:
  * lisp/image.el (image-animate, image-animate-timeout): Stop animating images
   in dead buffers.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/image.el                  image.el-20091113204419-o5vbwnq5f7feedwu-1320
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-02-25 21:55:45 +0000
+++ b/lisp/ChangeLog    2014-02-25 21:59:14 +0000
@@ -1,5 +1,8 @@
 2014-02-25  Glenn Morris  <address@hidden>
 
+       * image.el (image-animate, image-animate-timeout):
+       Stop animating images in dead buffers.  (Bug#16878)
+
        * emacs-lisp/edebug.el (defmacro): Fix debug spec.  (Bug#16868)
 
        * faces.el (tty-setup-hook, tty-run-terminal-initialization): Doc fixes.

=== modified file 'lisp/image.el'
--- a/lisp/image.el     2014-02-10 01:34:22 +0000
+++ b/lisp/image.el     2014-02-25 21:59:14 +0000
@@ -662,6 +662,7 @@
     (when animation
       (if (setq timer (image-animate-timer image))
          (cancel-timer timer))
+      (plist-put (cdr image) :animate-buffer (current-buffer))
       (run-with-timer 0.2 nil 'image-animate-timeout
                      image (or index 0) (car animation)
                      0 limit))))
@@ -726,30 +727,31 @@
 
 If the image has a non-nil :speed property, it acts as a multiplier
 for the animation speed.  A negative value means to animate in reverse."
-  (image-show-frame image n t)
-  (let* ((speed (image-animate-get-speed image))
-        (time (float-time))
-        (animation (image-multi-frame-p image))
-        ;; Subtract off the time we took to load the image from the
-        ;; stated delay time.
-        (delay (max (+ (* (or (cdr animation) image-default-frame-delay)
-                          (/ 1 (abs speed)))
-                       time (- (float-time)))
-                    image-minimum-frame-delay))
-        done)
-    (setq n (if (< speed 0)
-               (1- n)
-             (1+ n)))
-    (if limit
-       (cond ((>= n count) (setq n 0))
-             ((< n 0) (setq n (1- count))))
-      (and (or (>= n count) (< n 0)) (setq done t)))
-    (setq time-elapsed (+ delay time-elapsed))
-    (if (numberp limit)
-       (setq done (>= time-elapsed limit)))
-    (unless done
-      (run-with-timer delay nil 'image-animate-timeout
-                     image n count time-elapsed limit))))
+  (when (buffer-live-p (plist-get (cdr image) :animate-buffer))
+    (image-show-frame image n t)
+    (let* ((speed (image-animate-get-speed image))
+          (time (float-time))
+          (animation (image-multi-frame-p image))
+          ;; Subtract off the time we took to load the image from the
+          ;; stated delay time.
+          (delay (max (+ (* (or (cdr animation) image-default-frame-delay)
+                            (/ 1 (abs speed)))
+                         time (- (float-time)))
+                      image-minimum-frame-delay))
+          done)
+      (setq n (if (< speed 0)
+                 (1- n)
+               (1+ n)))
+      (if limit
+         (cond ((>= n count) (setq n 0))
+               ((< n 0) (setq n (1- count))))
+       (and (or (>= n count) (< n 0)) (setq done t)))
+      (setq time-elapsed (+ delay time-elapsed))
+      (if (numberp limit)
+         (setq done (>= time-elapsed limit)))
+      (unless done
+       (run-with-timer delay nil 'image-animate-timeout
+                       image n count time-elapsed limit)))))
 
 
 (defvar imagemagick-types-inhibit)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]