Subject: Re: bug#28518: Daemon mode only renders the first image file loaded

From: Damien Cassou <[email-masked]>
Date: Mon, 16 Oct 2017 10:59:14 +0200

I have a similar problem with a similar message

    ImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504

My setup:

- Fedora 26
- Emacs 25 and 26

However, I don't use the Emacs daemon and can reproduce with emacs -Q
directly:

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

Even opening the same image again fails. It used to work. I guess the
problem comes from an update of my system but I don't know for how long it
has been broken.

I'm CC'ing Paul as he has been involved in some changes that might be
related, especially:

commit 3c2c50260e19deff2a0a054882eaea4049f25a2f
Author: Paul Eggert <[email-masked]>
Date:   Thu Sep 29 20:09:37 2016 -0700

    Fix problems found by static checking --with-ns
    
    This is for Fedora 24 when configured with --enable-gcc-warnings.
    Although it does not fix all the problems, it fixes many of them.
    * src/frame.c (XParseGeometry):
    * src/nsterm.m (mouseDown:):
    Mark locals with UNINIT to pacify --enable-gcc-warnings.
    * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen):
    Remove unused macros.
    (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image)
    (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v)
    (xpm_put_color_table_v, xpm_get_color_table_v)
    (xpm_make_color_table_h, xpm_put_color_table_h)
    (xpm_get_color_table_h, xpm_load_image, xpm_load)
    (pbm_next_char, pbm_scan_number, pbm_load, svg_load)
    (svg_load_image):
    * src/nsfns.m (x_get_string_resource):
    * src/nsimage.m (ns_image_from_XBM):
    Fix pointer signedness problems.
    * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load)
    (imagemagick_load_image): Omit unused locals.
    * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types)
    (Fx_open_connection):
    * src/nsfont.m (ns_antialias_threshold):
    Move extern decl to nsterm.h so it can be checked.
    * src/nsmenu.m (svcsMenu, dockMenu):
    Move to the only file that uses them, so they can be static.
    * src/nsterm.h (find_and_call_menu_selection):
    * src/nsterm.m (x_set_frame_alpha):
    Omit duplicate decls.
    * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE.
    * src/nsfns.m (ns_tooltip, ns_display_info_for_name)
    (ns_set_name_as_filename, x_set_menu_bar_lines)
    (x_set_tool_bar_lines, x_set_internal_border_width):
    * src/nsterm.m (ns_drag_types, ns_draw_text_decoration):
    Now static.
    * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp):
    * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp):
    Remove; unused.
    * src/nsfont.m (ns_dump_glyphstring):
    * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp)
    (ns_clear_frame, keyDown:):
    Fix signedness problem with printf arg.
    * src/nsterm.h (ns_input_events, ns_finish_events):
    * src/nsterm.m (ns_finish_events, hide_bell):
    Prototype the decls.
    * src/nsterm.m (NSMenuDidBeginTrackingNotification):
    Omit unnecessary decl.
    (dockMenu):
    (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file.
    (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:)
    (toggleFullScreen:): Use FACE_FROM_ID instead of
    FACE_FROM_ID_OR_NULL in contexts where the caller expects the
    result to be non-null.
    (applicationShouldTerminate:): Fix misleading indentation.

commit cbb2e845187bfbcc62e2accc9df7891a2326608a
Author: Mark Oteiza <[email-masked]>
Date:   Wed Sep 28 13:08:12 2016 -0400

    Turn on more lexical-binding
    
    * lisp/dom.el:
    * lisp/faces.el:
    * lisp/htmlfontify.el: Turn on lexical-binding.
    (htmlfontify-string): Use pushnew instead of add-to-list.
    * lisp/info-xref.el:
:

^

^commit 3c2c50260e19deff2a0a054882eaea4049f25a2f
Author: Paul Eggert <[email-masked]>
Date:   Thu Sep 29 20:09:37 2016 -0700

    Fix problems found by static checking --with-ns
    
    This is for Fedora 24 when configured with --enable-gcc-warnings.
    Although it does not fix all the problems, it fixes many of them.
    * src/frame.c (XParseGeometry):
    * src/nsterm.m (mouseDown:):
    Mark locals with UNINIT to pacify --enable-gcc-warnings.
    * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen):
    Remove unused macros.
    (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image)
    (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v)
    (xpm_put_color_table_v, xpm_get_color_table_v)
    (xpm_make_color_table_h, xpm_put_color_table_h)
    (xpm_get_color_table_h, xpm_load_image, xpm_load)
    (pbm_next_char, pbm_scan_number, pbm_load, svg_load)
    (svg_load_image):
    * src/nsfns.m (x_get_string_resource):
    * src/nsimage.m (ns_image_from_XBM):
    Fix pointer signedness problems.
    * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load)
    (imagemagick_load_image): Omit unused locals.
    * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types)
    (Fx_open_connection):
    * src/nsfont.m (ns_antialias_threshold):
    Move extern decl to nsterm.h so it can be checked.
    * src/nsmenu.m (svcsMenu, dockMenu):
    Move to the only file that uses them, so they can be static.
    * src/nsterm.h (find_and_call_menu_selection):
    * src/nsterm.m (x_set_frame_alpha):
:

^

^commit 3c2c50260e19deff2a0a054882eaea4049f25a2f
Author: Paul Eggert <[email-masked]>
Date:   Thu Sep 29 20:09:37 2016 -0700

    Fix problems found by static checking --with-ns
    
    This is for Fedora 24 when configured with --enable-gcc-warnings.
    Although it does not fix all the problems, it fixes many of them.
    * src/frame.c (XParseGeometry):
    * src/nsterm.m (mouseDown:):
    Mark locals with UNINIT to pacify --enable-gcc-warnings.
    * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen):
    Remove unused macros.
    (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image)
    (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v)
    (xpm_put_color_table_v, xpm_get_color_table_v)
    (xpm_make_color_table_h, xpm_put_color_table_h)
    (xpm_get_color_table_h, xpm_load_image, xpm_load)
    (pbm_next_char, pbm_scan_number, pbm_load, svg_load)
    (svg_load_image):
    * src/nsfns.m (x_get_string_resource):
    * src/nsimage.m (ns_image_from_XBM):
    Fix pointer signedness problems.
    * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load)
    (imagemagick_load_image): Omit unused locals.
    * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types)
    (Fx_open_connection):
    * src/nsfont.m (ns_antialias_threshold):
    Move extern decl to nsterm.h so it can be checked.
    * src/nsmenu.m (svcsMenu, dockMenu):
    Move to the only file that uses them, so they can be static.
    * src/nsterm.h (find_and_call_menu_selection):
    * src/nsterm.m (x_set_frame_alpha):
    Omit duplicate decls.
    * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE.
    * src/nsfns.m (ns_tooltip, ns_display_info_for_name)
    (ns_set_name_as_filename, x_set_menu_bar_lines)
    (x_set_tool_bar_lines, x_set_internal_border_width):
    * src/nsterm.m (ns_drag_types, ns_draw_text_decoration):
    Now static.
    * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp):
    * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp):
    Remove; unused.
    * src/nsfont.m (ns_dump_glyphstring):
    * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp)
    (ns_clear_frame, keyDown:):
    Fix signedness problem with printf arg.
    * src/nsterm.h (ns_input_events, ns_finish_events):
    * src/nsterm.m (ns_finish_events, hide_bell):
    Prototype the decls.
    * src/nsterm.m (NSMenuDidBeginTrackingNotification):
    Omit unnecessary decl.
    (dockMenu):
    (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file.
    (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:)
    (toggleFullScreen:): Use FACE_FROM_ID instead of
    FACE_FROM_ID_OR_NULL in contexts where the caller expects the
    result to be non-null.
    (applicationShouldTerminate:): Fix misleading indentation.

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill