Subject: Daemon mode only renders the first image file loaded

From: s brown <[email-masked]>
Date: Tue, 19 Sep 2017 19:49:37 +0000

Hi there,

When running emacs in daemon mode if I open an image file it will be
rendered in a window. If I try to open a second image file it will not
be rendered and in its place there will be a square. The size of the
square is constant and appears unrelated to the size of the image.

This issue can also be reproduced by closing the emacsclient, starting it
again and trying to open the image file for a second time.

For the purposes or reproducing this issue I downloaded the following
two files

https://lists.gnu.org/archive/html/emacs-devel/2015-10/png8Z1ZsfVurU.png
https://www.gnu.org/graphics/gnu-head.jpg

as test.png and test.jpg respectively

* Image rendering works in normal mode

$ emacs -Q
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image loads
C-x C-c
$ emacs -Q
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image loads

* Second image file fails to load

$ emacs --daemon -Q
$ emacsclient -c
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image fails to load properly

It doesn't matter which image is loaded first, the second always fails
to render

* Loading same file in two different client sessions

$ emacs --daemon -Q
$ emacsclient -c
C-x C-f ~/test.png
...image loads
C-x C-c
$ emacsclient -c
C-x C-f ~/test.png
...image fails to load properly

In both of the failure cases I can see imagemagick errors in *messages*

Starting Emacs daemon.
When done with this frame, type C-x 5 0
Type C-c C-c to view the image as text.
When done with this frame, type C-x 5 0
Quit
QuitImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504
ImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504 [7 times]

I'm running Arch Linux and I can see from pacman that I have the
required libs for png and jpg support

$ uname -a
Linux OxBEEFED 4.12.13-1-ARCH #1 SMP PREEMPT Fri Sep 15 06:36:43 UTC 2017 x86_64 GNU/Linux

$ pacman -Qi imagemagick
Name            : imagemagick
Version         : 6.9.9.14-1
Description     : An image viewing/manipulation program
Architecture    : x86_64
URL             : http://www.imagemagick.org/
Licenses        : custom
Groups          : None
Provides        : None
Depends On      : libltdl  lcms2  libxt  fontconfig  libxext  liblqr  libraqm  opencl-icd-loader  perl>=5.26  perl<5.27
Optional Deps   : imagemagick-doc: for additional information
                  ghostscript: for Ghostscript support [installed]
                  openexr: for OpenEXR support
                  openjpeg2: for JP2 support [installed]
                  libwmf: for WMF support
                  librsvg: for SVG support [installed]
                  libxml2: for XML support [installed]
                  libpng: for PNG support [installed]
                  libwebp: for WEBP support [installed]
                  libraw: for DNG support
Required By     : emacs
Optional For    : feh
Conflicts With  : None
Replaces        : None
Installed Size  : 9.43 MiB
Packager        : Antonio Rojas <[email-masked]>
Build Date      : Mon 18 Sep 2017 16:01:53 BST
Install Date    : Mon 18 Sep 2017 19:19:33 BST
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.19)
 of 2017-09-16 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LC_COLLATE:
  value of $LC_CTYPE:
  value of $LC_MESSAGES:
  value of $LC_MONETARY:
  value of $LC_NUMERIC:
  value of $LC_TIME:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message idna dired format-spec rfc822
mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 89565 4765)
 (symbols 48 19839 0)
 (miscs 40 164 121)
 (strings 32 14521 4513)
 (string-bytes 1 414412)
 (vectors 16 11838)
 (vector-slots 8 432375 4931)
 (floats 8 170 125)
 (intervals 56 254 0)
 (buffers 976 21))