diff options
| author | Paul Eggert | 2017-10-16 23:44:32 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-10-16 23:45:31 -0700 |
| commit | b38724ab675ac02dec865930a35abd8e06ee8e76 (patch) | |
| tree | 80beb125a139d54fcfe60a0a4bcf608e03a7030f /src | |
| parent | 20cc68e871b8903a603aa4a89d2bc648d010781a (diff) | |
| download | emacs-b38724ab675ac02dec865930a35abd8e06ee8e76.tar.gz emacs-b38724ab675ac02dec865930a35abd8e06ee8e76.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c index 335a43e924d..c1c1671899b 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -8552,13 +8552,19 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8552 | char hint_buffer[MaxTextExtent]; | 8552 | char hint_buffer[MaxTextExtent]; |
| 8553 | char *filename_hint = NULL; | 8553 | char *filename_hint = NULL; |
| 8554 | 8554 | ||
| 8555 | /* Initialize the ImageMagick environment. */ | ||
| 8556 | static bool imagemagick_initialized; | ||
| 8557 | if (!imagemagick_initialized) | ||
| 8558 | { | ||
| 8559 | imagemagick_initialized = true; | ||
| 8560 | MagickWandGenesis (); | ||
| 8561 | } | ||
| 8562 | |||
| 8555 | /* Handle image index for image types who can contain more than one image. | 8563 | /* Handle image index for image types who can contain more than one image. |
| 8556 | Interface :index is same as for GIF. First we "ping" the image to see how | 8564 | Interface :index is same as for GIF. First we "ping" the image to see how |
| 8557 | many sub-images it contains. Pinging is faster than loading the image to | 8565 | many sub-images it contains. Pinging is faster than loading the image to |
| 8558 | find out things about it. */ | 8566 | find out things about it. */ |
| 8559 | 8567 | ||
| 8560 | /* Initialize the imagemagick environment. */ | ||
| 8561 | MagickWandGenesis (); | ||
| 8562 | image = image_spec_value (img->spec, QCindex, NULL); | 8568 | image = image_spec_value (img->spec, QCindex, NULL); |
| 8563 | ino = INTEGERP (image) ? XFASTINT (image) : 0; | 8569 | ino = INTEGERP (image) ? XFASTINT (image) : 0; |
| 8564 | image_wand = NewMagickWand (); | 8570 | image_wand = NewMagickWand (); |
| @@ -8859,8 +8865,10 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8859 | DestroyMagickWand (image_wand); | 8865 | DestroyMagickWand (image_wand); |
| 8860 | if (bg_wand) DestroyPixelWand (bg_wand); | 8866 | if (bg_wand) DestroyPixelWand (bg_wand); |
| 8861 | 8867 | ||
| 8862 | /* `MagickWandTerminus' terminates the imagemagick environment. */ | 8868 | /* Do not call MagickWandTerminus, to work around ImageMagick bug 825. See: |
| 8863 | MagickWandTerminus (); | 8869 | https://github.com/ImageMagick/ImageMagick/issues/825 |
| 8870 | Although this bug was introduced in ImageMagick 6.9.9-14 and | ||
| 8871 | fixed in 6.9.9-18, it's simpler to work around it in all versions. */ | ||
| 8864 | 8872 | ||
| 8865 | return 1; | 8873 | return 1; |
| 8866 | 8874 | ||
| @@ -8868,7 +8876,6 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8868 | DestroyMagickWand (image_wand); | 8876 | DestroyMagickWand (image_wand); |
| 8869 | if (bg_wand) DestroyPixelWand (bg_wand); | 8877 | if (bg_wand) DestroyPixelWand (bg_wand); |
| 8870 | 8878 | ||
| 8871 | MagickWandTerminus (); | ||
| 8872 | /* TODO more cleanup. */ | 8879 | /* TODO more cleanup. */ |
| 8873 | image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec); | 8880 | image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec); |
| 8874 | return 0; | 8881 | return 0; |