Subject: bug#44502: 28.0.50; Emacs crash using new frame

From: Eli Zaretskii <[email-masked]>
Date: Sat, 07 Nov 2020 16:05:51 +0200

> From: Andy Moreton <[email-masked]>
> Date: Sat, 7 Nov 2020 13:27:30 +0000
> 
> Emacs crashed when using a new frame. After a bootstrap of master, I
> could repeat the crash witht he following recipe:
>    - Run "emacs -Q"
>    - Type "C-x 5 2 RET" to create a new frame (which becomes selected)
>    - Type "C-x C-f" and emacs crashes
> 
> I bisected this using the recipe above, with:
>    git checkout master
>    git bisect start
>    git bisect bad
>    git bisect good c3a20804a8
> 
> Bisect reports the bad commit as:
>    2ecbf4cfae Allow minibuffer to stay in its original frame.
>               (2020-11-05 Alan Mackenzie)

Thanks.  Yes, the above recipe causes an assertion violation.  Alan,
can you take a look, please?

Here's a backtrace from an unoptimized build:

  window.c:554: Emacs fatal error: assertion failed: EQ (window, selected_window)

  Thread 1 hit Breakpoint 1, terminate_due_to_signal (sig=22,
      backtrace_limit=2147483647) at emacs.c:378
  378       signal (sig, SIG_DFL);
  (gdb) bt
  #0  terminate_due_to_signal (sig=22, backtrace_limit=2147483647)
      at emacs.c:378
  #1  0x012196a3 in die (
      msg=0x172067b <DEFAULT_REHASH_SIZE+783> "EQ (window, selected_window)",
      file=0x1720425 <DEFAULT_REHASH_SIZE+185> "window.c", line=554)
      at alloc.c:7341
  #2  0x010b9b57 in select_window (window=XIL(0xa000000006bc6220),
      norecord=XIL(0x30), inhibit_point_swap=false) at window.c:554
  #3  0x010b9d97 in Fselect_window (window=XIL(0xa000000006bc6220),
      norecord=XIL(0x30)) at window.c:630
  #4  0x0106036e in gui_consider_frame_title (frame=XIL(0xa000000006bc6020))
      at xdisp.c:12569
  #5  0x01060989 in prepare_menu_bars () at xdisp.c:12679
  #6  0x01068a85 in redisplay_internal () at xdisp.c:15575
  #7  0x01067518 in redisplay () at xdisp.c:15159
  #8  0x011677c4 in read_char (commandflag=1, map=XIL(0xc0000000062a2af0),
      prev_event=XIL(0), used_mouse_menu=0x82bdff, end_time=0x0)
      at keyboard.c:2497
  #9  0x0117f688 in read_key_sequence (keybuf=0x82c100, prompt=XIL(0),
      dont_downcase_last=false, can_return_switch_frame=true,
      fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9546
  #10 0x0116335a in command_loop_1 () at keyboard.c:1354
  #11 0x01255830 in internal_condition_case (bfun=0x1162c37 <command_loop_1>,
      handlers=XIL(0x90), hfun=0x1161e95 <cmd_error>) at eval.c:1359
  #12 0x011626a4 in command_loop_2 (ignore=XIL(0)) at keyboard.c:1095
  #13 0x01254a3d in internal_catch (tag=XIL(0x5940),
      func=0x1162667 <command_loop_2>, arg=XIL(0)) at eval.c:1120
  #14 0x01162589 in command_loop () at keyboard.c:1066
  #15 0x01161925 in recursive_edit_1 () at keyboard.c:718
  #16 0x011c17be in read_minibuf (map=XIL(0xc0000000062a3ab0),
      initial=XIL(0x8000000007142188), prompt=XIL(0x800000000592036c),
      expflag=false, histvar=XIL(0x6060), histpos=make_fixnum(0),
      defalt=XIL(0x80000000062abed0), allow_props=false,
      inherit_input_method=false) at minibuf.c:730
  #17 0x011c29a3 in Fread_from_minibuffer (prompt=XIL(0x800000000592036c),
      initial_contents=XIL(0x8000000007142188), keymap=XIL(0xc0000000062a3ab0),
      sys_read=XIL(0), hist=XIL(0x6060), default_value=XIL(0x80000000062abed0),
      inherit_input_method=XIL(0)) at minibuf.c:1021
  #18 0x0125bba7 in funcall_subr (subr=0x170ae60 <Sread_from_minibuffer>,
      numargs=7, args=0x82c8a0) at eval.c:2902
  #19 0x0125b2bc in Ffuncall (nargs=8, args=0x82c898) at eval.c:2809
  #20 0x012c5ad4 in exec_byte_code (bytestr=XIL(0x80000000059e4f44),
      vector=XIL(0xa0000000059e2c6c), maxdepth=make_fixnum(18),
      args_template=make_fixnum(2050), nargs=8, args=0x82cf40) at bytecode.c:632
  #21 0x0125bdeb in fetch_and_exec_byte_code (fun=XIL(0xa0000000059e2c3c),
      syms_left=make_fixnum(2050), nargs=8, args=0x82cf00) at eval.c:2931
  #22 0x0125c368 in funcall_lambda (fun=XIL(0xa0000000059e2c3c), nargs=8,
      arg_vector=0x82cf00) at eval.c:3012
  #23 0x0125b316 in Ffuncall (nargs=9, args=0x82cef8) at eval.c:2811
  #24 0x011c556b in Fcompleting_read (prompt=XIL(0x800000000592036c),
      collection=XIL(0x409f4b4), predicate=XIL(0x5e80),
      require_match=XIL(0x406c17c), initial_input=XIL(0x8000000007142188),
      hist=XIL(0x6060), def=XIL(0x80000000062abed0),
      inherit_input_method=XIL(0)) at minibuf.c:1733
  #25 0x0125bcde in funcall_subr (subr=0x170af60 <Scompleting_read>, numargs=7,
      args=0x82d210) at eval.c:2907
  #26 0x0125b2bc in Ffuncall (nargs=8, args=0x82d208) at eval.c:2809
  #27 0x012c5ad4 in exec_byte_code (bytestr=XIL(0x8000000005bdf1dc),
      vector=XIL(0xa0000000058da554), maxdepth=make_fixnum(22),
      args_template=make_fixnum(1537), nargs=6, args=0x82d9f0) at bytecode.c:632
  #28 0x0125bdeb in fetch_and_exec_byte_code (fun=XIL(0xa0000000058da524),
      syms_left=make_fixnum(1537), nargs=6, args=0x82d9c0) at eval.c:2931
  #29 0x0125c368 in funcall_lambda (fun=XIL(0xa0000000058da524), nargs=6,
      arg_vector=0x82d9c0) at eval.c:3012
  #30 0x0125b316 in Ffuncall (nargs=7, args=0x82d9b8) at eval.c:2811
  #31 0x012c5ad4 in exec_byte_code (bytestr=XIL(0x8000000005bdf25c),
      vector=XIL(0xa0000000058da4dc), maxdepth=make_fixnum(13),
      args_template=make_fixnum(1537), nargs=4, args=0x82dfc0) at bytecode.c:632
  #32 0x0125bdeb in fetch_and_exec_byte_code (fun=XIL(0xa0000000058da4ac),
      syms_left=make_fixnum(1537), nargs=4, args=0x82dfa0) at eval.c:2931
  #33 0x0125c368 in funcall_lambda (fun=XIL(0xa0000000058da4ac), nargs=4,
      arg_vector=0x82dfa0) at eval.c:3012
  #34 0x0125b316 in Ffuncall (nargs=5, args=0x82df98) at eval.c:2811
  #35 0x012c5ad4 in exec_byte_code (bytestr=XIL(0x8000000005920404),
      vector=XIL(0xa0000000059203dc), maxdepth=make_fixnum(7),
      args_template=make_fixnum(514), nargs=2, args=0x82e570) at bytecode.c:632
  #36 0x0125bdeb in fetch_and_exec_byte_code (fun=XIL(0xa0000000059203ac),
      syms_left=make_fixnum(514), nargs=2, args=0x82e560) at eval.c:2931
  #37 0x0125c368 in funcall_lambda (fun=XIL(0xa0000000059203ac), nargs=2,
      arg_vector=0x82e560) at eval.c:3012
  #38 0x0125b316 in Ffuncall (nargs=3, args=0x82e558) at eval.c:2811
  #39 0x012c5ad4 in exec_byte_code (bytestr=XIL(0x8000000005920434),
      vector=XIL(0xa00000000592034c), maxdepth=make_fixnum(3),
      args_template=XIL(0), nargs=0, args=0x0) at bytecode.c:632
  #40 0x012c4ba9 in Fbyte_code (bytestr=XIL(0x8000000005920434),
      vector=XIL(0xa00000000592034c), maxdepth=make_fixnum(3)) at bytecode.c:334
  #41 0x01258e92 in eval_sub (form=XIL(0xc00000000592031c)) at eval.c:2292
  #42 0x0125827c in Feval (form=XIL(0xc00000000592031c), lexical=XIL(0))
      at eval.c:2115
  #43 0x0124c06a in Fcall_interactively (function=XIL(0x40e4e14),
      record_flag=XIL(0), keys=XIL(0xa000000005eb8e9c)) at callint.c:322
  #44 0x0125b8a9 in funcall_subr (subr=0x170d7a0 <Scall_interactively>,
      numargs=3, args=0x82ef80) at eval.c:2887
  #45 0x0125b2bc in Ffuncall (nargs=4, args=0x82ef78) at eval.c:2809
  #46 0x012c5ad4 in exec_byte_code (bytestr=XIL(0x80000000059f24ac),
      vector=XIL(0xa0000000059f2254), maxdepth=make_fixnum(13),
      args_template=make_fixnum(1025), nargs=1, args=0x82f5d0) at bytecode.c:632
  #47 0x0125bdeb in fetch_and_exec_byte_code (fun=XIL(0xa0000000059f2224),
      syms_left=make_fixnum(1025), nargs=1, args=0x82f5c8) at eval.c:2931
  #48 0x0125c368 in funcall_lambda (fun=XIL(0xa0000000059f2224), nargs=1,
      arg_vector=0x82f5c8) at eval.c:3012
  #49 0x0125b316 in Ffuncall (nargs=2, args=0x82f5c0) at eval.c:2811
  #50 0x0125a5e8 in call1 (fn=XIL(0x3f30), arg1=XIL(0x40e4e14)) at eval.c:2669
  #51 0x01163878 in command_loop_1 () at keyboard.c:1467
  #52 0x01255830 in internal_condition_case (bfun=0x1162c37 <command_loop_1>,
      handlers=XIL(0x90), hfun=0x1161e95 <cmd_error>) at eval.c:1359
  #53 0x011626a4 in command_loop_2 (ignore=XIL(0)) at keyboard.c:1095
  #54 0x01254a3d in internal_catch (tag=XIL(0xe130),
      func=0x1162667 <command_loop_2>, arg=XIL(0)) at eval.c:1120
  #55 0x01162621 in command_loop () at keyboard.c:1074
  #56 0x01161925 in recursive_edit_1 () at keyboard.c:718
  #57 0x01161b93 in Frecursive_edit () at keyboard.c:790
  #58 0x0115d3a8 in main (argc=2, argv=0xa428e0) at emacs.c:2047

  Lisp Backtrace:
  "redisplay_internal (C function)" (0x0)
  "read-from-minibuffer" (0x82c8a0)
  "completing-read-default" (0x82cf00)
  "completing-read" (0x82d210)
  "read-file-name-default" (0x82d9c0)
  "read-file-name" (0x82dfa0)
  "find-file-read-args" (0x82e560)
  "byte-code" (0x82ea18)
  "call-interactively" (0x82ef80)
  "command-execute" (0x82f5c8)