all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Nicolas Petton <nicolas@petton.fr>,
	Damien Cassou <damien@cassou.me>, s brown <sjbrown@live.co.uk>
Cc: 28518@debbugs.gnu.org, 28770@debbugs.gnu.org,
	28632@debbugs.gnu.org, 28633@debbugs.gnu.org,
	28626@debbugs.gnu.org, Waleed Yousef <wyousef@fcih.net>,
	Joseph Mingrone <jrm@ftfl.ca>,
	Noam Postavsky <npostavs@users.sourceforge.net>,
	Matt Lundin <mdl@imapmail.org>
Subject: bug#28633: bug#28518: Daemon mode only renders the first image file loaded
Date: Mon, 16 Oct 2017 23:57:01 -0700	[thread overview]
Message-ID: <c0fd7dd8-3de8-5548-1997-57400832a707@cs.ucla.edu> (raw)
In-Reply-To: <87mv4rux1o.fsf@petton.fr>

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Nicolas Petton wrote:

> Apparently, the issue has been resolved in 6.9.9-18.

Yes, that's right. Still, the ImageMagick bug is so easy to work around, and the 
workaround so benign, that I installed the attached into the emacs-26 branch to 
do that.  Although Fedora will probably upgrade its ImageMagick version soon and 
this upgrade will eventually filter out to users, the testing hassles are 
significant in the meantime.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Work-around-ImageMagick-bug-825.patch --]
[-- Type: text/x-patch; name="0001-Work-around-ImageMagick-bug-825.patch", Size: 2371 bytes --]

From b38724ab675ac02dec865930a35abd8e06ee8e76 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 16 Oct 2017 23:44:32 -0700
Subject: [PATCH] Work around ImageMagick bug 825

This should fix several bugs reported recently against Emacs
(Bug#28518, Bug#28626, Bug#28632, Bug#28633, Bug#28770).
* src/image.c (imagemagick_load_image):
Do not call MagickWandTerminus.
---
 src/image.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/image.c b/src/image.c
index 335a43e..c1c1671 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8552,13 +8552,19 @@ imagemagick_load_image (struct frame *f, struct image *img,
   char hint_buffer[MaxTextExtent];
   char *filename_hint = NULL;
 
+  /* Initialize the ImageMagick environment.  */
+  static bool imagemagick_initialized;
+  if (!imagemagick_initialized)
+    {
+      imagemagick_initialized = true;
+      MagickWandGenesis ();
+    }
+
   /* Handle image index for image types who can contain more than one image.
      Interface :index is same as for GIF.  First we "ping" the image to see how
      many sub-images it contains.  Pinging is faster than loading the image to
      find out things about it.  */
 
-  /* Initialize the imagemagick environment.  */
-  MagickWandGenesis ();
   image = image_spec_value (img->spec, QCindex, NULL);
   ino = INTEGERP (image) ? XFASTINT (image) : 0;
   image_wand = NewMagickWand ();
@@ -8859,8 +8865,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
   DestroyMagickWand (image_wand);
   if (bg_wand) DestroyPixelWand (bg_wand);
 
-  /* `MagickWandTerminus' terminates the imagemagick environment.  */
-  MagickWandTerminus ();
+  /* Do not call MagickWandTerminus, to work around ImageMagick bug 825.  See:
+     https://github.com/ImageMagick/ImageMagick/issues/825
+     Although this bug was introduced in ImageMagick 6.9.9-14 and
+     fixed in 6.9.9-18, it's simpler to work around it in all versions.  */
 
   return 1;
 
@@ -8868,7 +8876,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
   DestroyMagickWand (image_wand);
   if (bg_wand) DestroyPixelWand (bg_wand);
 
-  MagickWandTerminus ();
   /* TODO more cleanup.  */
   image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec);
   return 0;
-- 
2.7.4


  reply	other threads:[~2017-10-17  6:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 19:49 bug#28518: Daemon mode only renders the first image file loaded s brown
2017-10-16  8:59 ` Damien Cassou
2017-10-16 11:42   ` Nicolas Petton
2017-10-16 11:55     ` Nicolas Petton
2017-10-17  6:57       ` Paul Eggert [this message]
2017-10-17  7:19         ` bug#28633: " Damien Cassou
2017-10-17  8:53           ` bug#28770: " Nicolas Petton
2017-10-17 14:42         ` bug#28626: " Eli Zaretskii
2017-10-17 18:24           ` bug#28633: " Paul Eggert
2017-10-16 10:42 ` Noam Postavsky
2017-10-16 11:37   ` Damien Cassou
2017-10-16 15:14   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0fd7dd8-3de8-5548-1997-57400832a707@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=28518@debbugs.gnu.org \
    --cc=28626@debbugs.gnu.org \
    --cc=28632@debbugs.gnu.org \
    --cc=28633@debbugs.gnu.org \
    --cc=28770@debbugs.gnu.org \
    --cc=damien@cassou.me \
    --cc=jrm@ftfl.ca \
    --cc=mdl@imapmail.org \
    --cc=nicolas@petton.fr \
    --cc=npostavs@users.sourceforge.net \
    --cc=sjbrown@live.co.uk \
    --cc=wyousef@fcih.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.