Subject: bug#73600: 31.0.50; Visual wrap prefix mode and image display

From: Eli Zaretskii <[email-masked]>
Date: Wed, 02 Oct 2024 18:42:09 +0300

> From: Gautier Ponsinet <[email-masked]>
> Date: Wed, 02 Oct 2024 16:04:02 +0300
> 
> The mode visual-wrap-prefix-mode sometimes causes images to be displayed
> incorrectly in emacs (in a mosaic-like way).
> 
> To this mail are attached screenshots of the problem and the image file
> used in the screenshots which is from wikipedia:
> - https://fr.wikipedia.org/wiki/Olcades
> - https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Iberia_300BC-fr.svg/langfr-873px-Iberia_300BC-fr.svg.png
> 
> Note that the error does not occur with all images, but I am not able to
> identify which characteristic of an image makes the problem appear.
> Still, I have encountered the problem with multiple image files.
> 
> In emacs -Q:
> - enable global-visual-wrap-prefix-mode,
> - open the attached image.

In a build with --enable-checking, this recipe causes an assertion
violation:

  dispnew.c:4495: Emacs fatal error: assertion failed: entry || verify_row_hash (row)

  Thread 1 hit Breakpoint 1, terminate_due_to_signal (sig=22,
      backtrace_limit=2147483647) at emacs.c:432
  432       signal (sig, SIG_DFL);
  (gdb) bt
  #0  terminate_due_to_signal (sig=22, backtrace_limit=2147483647) at emacs.c:432
  #1  0x0053d2d9 in die (msg=0xc11c78 "entry || verify_row_hash (row)",
      file=0xc112a7 "dispnew.c", line=4495) at alloc.c:8057
  #2  0x0032d713 in add_row_entry (row=0xb9ed5b0) at dispnew.c:4495
  #3  0x0032df1d in scrolling_window (w=0xb941fb8, tab_line_p=0)
      at dispnew.c:4735
  #4  0x0032b8eb in update_window (w=0xb941fb8, force_p=true) at dispnew.c:3735
  #5  0x0032ae0d in update_window_tree (w=0xb941fb8, force_p=true)
      at dispnew.c:3491
  #6  0x0032a6b4 in update_frame (f=0xb941d98, force_p=true,
      inhibit_hairy_id_p=false) at dispnew.c:3326
  #7  0x0038ac25 in redisplay_internal () at xdisp.c:17561
  #8  0x003883e7 in redisplay () at xdisp.c:16656
  #9  0x0048a5f0 in read_char (commandflag=1, map=XIL(0xc000000005788d00),
      prev_event=XIL(0), used_mouse_menu=0x61ff31f, end_time=0x0)
      at keyboard.c:2673
  #10 0x004a2c09 in read_key_sequence (keybuf=0x61ff5f8, prompt=XIL(0),
      dont_downcase_last=false, can_return_switch_frame=true,
      fix_current_buffer=true, prevent_redisplay=false,
      disable_text_conversion_p=false) at keyboard.c:10747
  #11 0x004861cb in command_loop_1 () at keyboard.c:1424
  #12 0x0057b9ad in internal_condition_case (bfun=0x485b69 <command_loop_1>,
      handlers=XIL(0x90), hfun=0x484bc2 <cmd_error>) at eval.c:1598
  #13 0x004855ce in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1163
  #14 0x0057ab2a in internal_catch (tag=XIL(0x12750),
      func=0x485597 <command_loop_2>, arg=XIL(0x90)) at eval.c:1277
  #15 0x00485539 in command_loop () at keyboard.c:1141
  #16 0x00484622 in recursive_edit_1 () at keyboard.c:749
  #17 0x004848c0 in Frecursive_edit () at keyboard.c:832
  #18 0x0047f9e1 in main (argc=2, argv=0x6322570) at emacs.c:2624