Subject: Re: bug#51007: 27.2; emacs hangs when using window-toggle-side-windows

From: martin rudalics <[email-masked]>
Date: Sat, 9 Oct 2021 20:57:52 +0200

> I made little progress with this, and here are few of my observations.
 > 1. The bug is producible in non-gui, when starting emacs with `-nw`, even on emacs27.2
 >     I am using the info and help buffers as side windows.

Very good.  Can you reproduce it with a GUI build too?  I still cannot
here.

 > 2. I tried the stepping through process, it took me through following function calls
 >     `window-toggle-side-windows`
 >     `delete-other-windows`
 >      in this function it takes me to
 >     `delete-other-windows-internal`
 >
 >        ;; If WINDOW is the main window of its frame do nothing.
 >        (if (eq window main)
 >            ;; Give a message to the user if this has been called as a
 >            ;; command.
 >            (when (called-interactively-p 'interactive)
 >              (message "No other windows to delete"))
 > =>      (delete-other-windows-internal window main)
 >          (window--check frame))
 >
 > And it stalls after this point, the `window` and `main` argument have non-nil values.

Here on the emacs-28 branch (with a non-optimized GTK build) I get an
assertion failure instead with the following backtrace:

#0  0x00000000005acb54 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at ../../src/emacs.c:400
#1  0x000000000065acc7 in die (msg=0x786590 "r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA] && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]", file=0x78629b "../../src/dispnew.c", line=1899) at ../../src/alloc.c:7478
#2  0x000000000041cfab in fake_current_matrices (window=XIL(0x2444a2d)) at ../../src/dispnew.c:1898
#3  0x000000000041ce37 in fake_current_matrices (window=XIL(0x252e995)) at ../../src/dispnew.c:1882
#4  0x000000000041d7ba in adjust_frame_glyphs_for_frame_redisplay (f=0x24447e8) at ../../src/dispnew.c:2111
#5  0x000000000041cd11 in adjust_frame_glyphs (f=0x24447e8) at ../../src/dispnew.c:1838
#6  0x00000000004d409c in Fdelete_other_windows_internal (window=XIL(0x252e995), root=XIL(0x242e1b5)) at ../../src/window.c:3427
#7  0x000000000069488b in funcall_subr (subr=0xc589a0 <Sdelete_other_windows_internal>, numargs=2, args=0x7ffcbd5c2870) at ../../src/eval.c:3103
#8  0x0000000000694324 in Ffuncall (nargs=3, args=0x7ffcbd5c2868) at ../../src/eval.c:3026
#9  0x00000000006eed2a in exec_byte_code (bytestr=XIL(0x7f23c134b2d4), vector=XIL(0x7f23c134b045), maxdepth=make_fixnum(11), args_template=make_fixnum(512), nargs=1, args=0x7ffcbd5c2de8) at ../../src/bytecode.c:632
#10 0x0000000000694aec in fetch_and_exec_byte_code (fun=XIL(0x7f23c134afed), syms_left=make_fixnum(512), nargs=1, args=0x7ffcbd5c2de0) at ../../src/eval.c:3150
#11 0x0000000000694f72 in funcall_lambda (fun=XIL(0x7f23c134afed), nargs=1, arg_vector=0x7ffcbd5c2de0) at ../../src/eval.c:3231
#12 0x0000000000694c96 in apply_lambda (fun=XIL(0x7f23c134afed), args=XIL(0x254a5b3), count=18) at ../../src/eval.c:3175
#13 0x0000000000692dbd in eval_sub (form=XIL(0x254a583)) at ../../src/eval.c:2548
#14 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#15 0x000000000068ebce in Flet (args=XIL(0x254a573)) at ../../src/eval.c:1054
#16 0x00000000006927c2 in eval_sub (form=XIL(0x254a533)) at ../../src/eval.c:2454
#17 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#18 0x000000000068c964 in Fcond (args=XIL(0x254a5e3)) at ../../src/eval.c:448
#19 0x00000000006927c2 in eval_sub (form=XIL(0x254a403)) at ../../src/eval.c:2454
#20 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#21 0x000000000068e6bb in FletX (args=XIL(0x254abd3)) at ../../src/eval.c:986
#22 0x00000000006927c2 in eval_sub (form=XIL(0x254ab33)) at ../../src/eval.c:2454
#23 0x000000000068ca77 in Fprogn (body=XIL(0)) at ../../src/eval.c:468
#24 0x000000000069547b in funcall_lambda (fun=XIL(0x254a1a3), nargs=0, arg_vector=0x0) at ../../src/eval.c:3306
#25 0x000000000069448b in Ffuncall (nargs=1, args=0x7ffcbd5c3878) at ../../src/eval.c:3042
#26 0x0000000000688029 in Ffuncall_interactively (nargs=1, args=0x7ffcbd5c3878) at ../../src/callint.c:260
#27 0x000000000069475e in funcall_subr (subr=0xc63f20 <Sfuncall_interactively>, numargs=1, args=0x7ffcbd5c3878) at ../../src/eval.c:3081
#28 0x0000000000694324 in Ffuncall (nargs=2, args=0x7ffcbd5c3870) at ../../src/eval.c:3026
#29 0x0000000000693112 in Fapply (nargs=3, args=0x7ffcbd5c3870) at ../../src/eval.c:2609
#30 0x00000000006884b1 in Fcall_interactively (function=XIL(0x7f23c09fcab8), record_flag=XIL(0), keys=XIL(0x7f23c18b69f5)) at ../../src/callint.c:353
#31 0x00000000006948b7 in funcall_subr (subr=0xc63f60 <Scall_interactively>, numargs=3, args=0x7ffcbd5c3b30) at ../../src/eval.c:3106
#32 0x0000000000694324 in Ffuncall (nargs=4, args=0x7ffcbd5c3b28) at ../../src/eval.c:3026
#33 0x00000000006eed2a in exec_byte_code (bytestr=XIL(0x7f23c129fd0c), vector=XIL(0x7f23c129f975), maxdepth=make_fixnum(13), args_template=make_fixnum(1025), nargs=1, args=0x7ffcbd5c40a0) at ../../src/bytecode.c:632
#34 0x0000000000694aec in fetch_and_exec_byte_code (fun=XIL(0x7f23c129f945), syms_left=make_fixnum(1025), nargs=1, args=0x7ffcbd5c4098) at ../../src/eval.c:3150
#35 0x0000000000694f72 in funcall_lambda (fun=XIL(0x7f23c129f945), nargs=1, arg_vector=0x7ffcbd5c4098) at ../../src/eval.c:3231
#36 0x0000000000694378 in Ffuncall (nargs=2, args=0x7ffcbd5c4090) at ../../src/eval.c:3030
#37 0x0000000000693c41 in call1 (fn=XIL(0x43e0), arg1=XIL(0x7f23c09fcab8)) at ../../src/eval.c:2886
#38 0x00000000005b5298 in command_loop_1 () at ../../src/keyboard.c:1505
#39 0x000000000068fdd6 in internal_condition_case (bfun=0x5b4a3f <command_loop_1>, handlers=XIL(0x90), hfun=0x5b3ec1 <cmd_error>) at ../../src/eval.c:1453
#40 0x00000000005b4624 in command_loop_2 (handlers=XIL(0x90)) at ../../src/keyboard.c:1133
#41 0x000000000068f05b in internal_catch (tag=XIL(0xe370), func=0x5b45fd <command_loop_2>, arg=XIL(0x90)) at ../../src/eval.c:1184
#42 0x00000000005b45c8 in command_loop () at ../../src/keyboard.c:1111
#43 0x00000000005b398c in recursive_edit_1 () at ../../src/keyboard.c:720
#44 0x00000000005b3ba0 in Frecursive_edit () at ../../src/keyboard.c:803
#45 0x00000000005afa5b in main (argc=5, argv=0x7ffcbd5c45a8) at ../../src/emacs.c:2310

Lisp Backtrace:
"delete-other-windows-internal" (0xbd5c2870)
"delete-other-windows" (0xbd5c2de0)
"let" (0xbd5c3100)
"cond" (0xbd5c3290)
"let*" (0xbd5c3450)
"window-toggle-side-windows" (0xbd5c3880)
"funcall-interactively" (0xbd5c3878)
"call-interactively" (0xbd5c3b30)
"command-execute" (0xbd5c4098)

I'll try to look into what goes wrong here as soon as I understand what
that assertion really means.  I suppose yours is an optimized build so
the assertion won't trigger.

Please make sure to always CC to [email-masked].

Many thanks, martin