Subject: Re: bug#58164: 28.1; keybinding C-z to suspend-frame in fvwm windowmanager seems to get lost after first use.

From: Jos de Kloe <[email-masked]>
Date: Mon, 3 Oct 2022 19:39:20 +0200

On 10/3/22 18:47, Eli Zaretskii wrote:
>> Date: Mon, 3 Oct 2022 08:37:06 +0200
>> Cc: [email-masked]
>> From: Jos de Kloe <[email-masked]>
>>
>> second time I hit C-z:
>>
>> Thread 1 "emacs" hit Breakpoint 1, x_iconify_frame (f=0xe46c70) at
>> xterm.c:11976
>> 11976   {
>> (gdb) n
>> 11982     if (FRAME_DISPLAY_INFO (f)->highlight_frame == f)
>> (gdb) n
>> 11983       FRAME_DISPLAY_INFO (f)->highlight_frame = 0;
>> (gdb) n
>> 11985     if (FRAME_ICONIFIED_P (f))
>> (gdb) n
>> Ffuncall (nargs=1, args=args@entry=0x7fffffffd258) at eval.c:3048
>> 3048      lisp_eval_depth--;
>> (gdb) n
>> 3049      if (backtrace_debug_on_exit (specpdl + count))
>> (gdb) n
>> 3051      specpdl_ptr--;
>> (gdb) n
>> 3052      return val;
>> (gdb) n
>>
>> I hope this helps to zoom in on the problem.
> 
> It gives a hint.  Can you type "bt" before you type "n" here:
> 
>> 11985     if (FRAME_ICONIFIED_P (f))
>> (gdb) n
> 
> and show the resulting backtrace?  Also, type "bt" _after_ you type
> "n" there and see this line:

before:

Thread 1 "emacs" hit Breakpoint 1, x_iconify_frame (f=0xe293e0) at 
xterm.c:11976
11976   {
(gdb) n
11982     if (FRAME_DISPLAY_INFO (f)->highlight_frame == f)
(gdb) n
11983       FRAME_DISPLAY_INFO (f)->highlight_frame = 0;
(gdb) bt
#0  x_iconify_frame (f=0xe293e0) at xterm.c:11983
#1  0x0000000000428191 in Ficonify_frame (frame=0x0) at frame.c:2811
#2  0x00000000005683b2 in funcall_subr
     (subr=0x989340 <Siconify_frame>, numargs=numargs@entry=0, 
args=args@entry=0x7fffffffd260) at eval.c:3098
#3  0x0000000000566d80 in Ffuncall (nargs=1, args=args@entry=0x7fffffffd258)
     at eval.c:3023
#4  0x000000000059a50a in exec_byte_code
     (bytestr=0x7ffff1aea90c, vector=<optimized out>, 
maxdepth=<optimized out>, args_template=args_template@entry=0x2, 
nargs=nargs@entry=0, args=<optimized out>,
     args@entry=0x7fffffffd400) at bytecode.c:632
#5  0x0000000000569541 in fetch_and_exec_byte_code
     (args=0x7fffffffd400, nargs=0, syms_left=0x2, fun=0x7ffff1aea8a5)
     at /home/jos/temp_emacs/emacs-28.1/src/lisp.h:1853
#6  funcall_lambda
     (fun=0x7ffff1aea8a5, nargs=nargs@entry=0, 
arg_vector=arg_vector@entry=0x7fffffffd400)
     at eval.c:3228
#7  0x0000000000566d69 in Ffuncall (nargs=1, args=args@entry=0x7fffffffd3f8)
     at eval.c:3027
#8  0x000000000059a50a in exec_byte_code
     (bytestr=0x7ffff1aea94c, vector=<optimized out>, 
maxdepth=<optimized out>, args_template=args_template@entry=0x2, 
nargs=nargs@entry=0, args=<optimized out>,
     args@entry=0x7fffffffd7b0) at bytecode.c:632
#9  0x0000000000569541 in fetch_and_exec_byte_code
     (args=0x7fffffffd7b0, nargs=0, syms_left=0x2, fun=0x7ffff1aea7a5)
     at /home/jos/temp_emacs/emacs-28.1/src/lisp.h:1853
#10 funcall_lambda
     (fun=0x7ffff1aea7a5, nargs=nargs@entry=0, 
arg_vector=arg_vector@entry=0x7fffffffd7b0)
     at eval.c:3228
#11 0x0000000000566d69 in Ffuncall (nargs=nargs@entry=1, 
args=args@entry=0x7fffffffd7a8)
     at eval.c:3027
#12 0x0000000000563b8f in Ffuncall_interactively (nargs=1, 
args=0x7fffffffd7a8)
#13 0x0000000000568388 in funcall_subr
     (subr=0x996740 <Sfuncall_interactively>, numargs=numargs@entry=1, 
args=args@entry=0x7fffffffd7a8) at eval.c:3078
#14 0x0000000000566d80 in Ffuncall (nargs=nargs@entry=2, 
args=args@entry=0x7fffffffd7a0)
     at eval.c:3023
#15 0x0000000000567098 in Fapply (nargs=nargs@entry=3, 
args=args@entry=0x7fffffffd7a0)
     at eval.c:2606
#16 0x00000000005640fa in Fcall_interactively
     (function=0x7ffff10e1250, record_flag=0x0, keys=0x7ffff1e7eae5) at 
callint.c:353
#17 0x00000000005683d8 in funcall_subr
     (subr=0x996700 <Scall_interactively>, numargs=numargs@entry=3, 
args=args@entry=0x7fffffffd900) at eval.c:3103
#18 0x0000000000566d80 in Ffuncall (nargs=4, args=args@entry=0x7fffffffd8f8)
     at eval.c:3023
#19 0x000000000059a50a in exec_byte_code
     (bytestr=0x7ffff186486c, vector=<optimized out>, 
maxdepth=<optimized out>, args_template=args_template@entry=0x1006, 
nargs=nargs@entry=1, args=<optimized out>,
     args@entry=0x7fffffffdb48) at bytecode.c:632
#20 0x0000000000569541 in fetch_and_exec_byte_code
     (args=0x7fffffffdb48, nargs=1, syms_left=0x1006, fun=0x7ffff18644a5)
     at /home/jos/temp_emacs/emacs-28.1/src/lisp.h:1853
#21 funcall_lambda
     (fun=0x7ffff18644a5, nargs=nargs@entry=1, 
arg_vector=arg_vector@entry=0x7fffffffdb48)
     at eval.c:3228
#22 0x0000000000566d69 in Ffuncall (nargs=nargs@entry=2, 
args=args@entry=0x7fffffffdb40)
     at eval.c:3027
#23 0x0000000000566f19 in call1 (fn=fn@entry=0x4590, arg1=<optimized 
out>) at eval.c:2883
#24 0x0000000000502a36 in command_loop_1 () at keyboard.c:1505
#25 0x000000000056612d in internal_condition_case
     (bfun=bfun@entry=0x5023eb <command_loop_1>, 
handlers=handlers@entry=0x90, hfun=hfun@entry=0x4f7da1 <cmd_error>) at 
eval.c:1450
#26 0x00000000004f4841 in command_loop_2 (handlers=handlers@entry=0x90)
     at keyboard.c:1133
#27 0x00000000005660a4 in internal_catch
     (tag=tag@entry=0xe850, func=func@entry=0x4f482b <command_loop_2>, 
arg=arg@entry=0x90)
     at eval.c:1181
#28 0x00000000004f480d in command_loop () at keyboard.c:1111
#29 0x00000000004f7a2e in recursive_edit_1 () at keyboard.c:720
#30 0x00000000004f7cf9 in Frecursive_edit () at keyboard.c:803
#31 0x00000000004f3d72 in main (argc=3, argv=0x7fffffffdfd8) at emacs.c:2354

and after:

(gdb) n
11985     if (FRAME_ICONIFIED_P (f))
(gdb) bt
#0  x_iconify_frame (f=0xe293e0) at xterm.c:11985
#1  0x0000000000428191 in Ficonify_frame (frame=0x0) at frame.c:2811
#2  0x00000000005683b2 in funcall_subr
     (subr=0x989340 <Siconify_frame>, numargs=numargs@entry=0, 
args=args@entry=0x7fffffffd260) at eval.c:3098
#3  0x0000000000566d80 in Ffuncall (nargs=1, args=args@entry=0x7fffffffd258)
     at eval.c:3023
#4  0x000000000059a50a in exec_byte_code
     (bytestr=0x7ffff1aea90c, vector=<optimized out>, 
maxdepth=<optimized out>, args_template=args_template@entry=0x2, 
nargs=nargs@entry=0, args=<optimized out>,
     args@entry=0x7fffffffd400) at bytecode.c:632
#5  0x0000000000569541 in fetch_and_exec_byte_code
     (args=0x7fffffffd400, nargs=0, syms_left=0x2, fun=0x7ffff1aea8a5)
     at /home/jos/temp_emacs/emacs-28.1/src/lisp.h:1853
#6  funcall_lambda
     (fun=0x7ffff1aea8a5, nargs=nargs@entry=0, 
arg_vector=arg_vector@entry=0x7fffffffd400)
     at eval.c:3228
#7  0x0000000000566d69 in Ffuncall (nargs=1, args=args@entry=0x7fffffffd3f8)
     at eval.c:3027
#8  0x000000000059a50a in exec_byte_code
     (bytestr=0x7ffff1aea94c, vector=<optimized out>, 
maxdepth=<optimized out>, args_template=args_template@entry=0x2, 
nargs=nargs@entry=0, args=<optimized out>,
     args@entry=0x7fffffffd7b0) at bytecode.c:632
#9  0x0000000000569541 in fetch_and_exec_byte_code
     (args=0x7fffffffd7b0, nargs=0, syms_left=0x2, fun=0x7ffff1aea7a5)
     at /home/jos/temp_emacs/emacs-28.1/src/lisp.h:1853
#10 funcall_lambda
     (fun=0x7ffff1aea7a5, nargs=nargs@entry=0, 
arg_vector=arg_vector@entry=0x7fffffffd7b0)
     at eval.c:3228
#11 0x0000000000566d69 in Ffuncall (nargs=nargs@entry=1, 
args=args@entry=0x7fffffffd7a8)
     at eval.c:3027
#12 0x0000000000563b8f in Ffuncall_interactively (nargs=1, 
args=0x7fffffffd7a8)
     at callint.c:260
#13 0x0000000000568388 in funcall_subr
     (subr=0x996740 <Sfuncall_interactively>, numargs=numargs@entry=1, 
args=args@entry=0x7fffffffd7a8) at eval.c:3078
#14 0x0000000000566d80 in Ffuncall (nargs=nargs@entry=2, 
args=args@entry=0x7fffffffd7a0)
     at eval.c:3023
#15 0x0000000000567098 in Fapply (nargs=nargs@entry=3, 
args=args@entry=0x7fffffffd7a0)
     at eval.c:2606
#16 0x00000000005640fa in Fcall_interactively
     (function=0x7ffff10e1250, record_flag=0x0, keys=0x7ffff1e7eae5) at 
callint.c:353
#17 0x00000000005683d8 in funcall_subr
     (subr=0x996700 <Scall_interactively>, numargs=numargs@entry=3, 
args=args@entry=0x7fffffffd900) at eval.c:3103
#18 0x0000000000566d80 in Ffuncall (nargs=4, args=args@entry=0x7fffffffd8f8)
     at eval.c:3023
#19 0x000000000059a50a in exec_byte_code
     (bytestr=0x7ffff186486c, vector=<optimized out>, 
maxdepth=<optimized out>, args_template=args_template@entry=0x1006, 
nargs=nargs@entry=1, args=<optimized out>,
     args@entry=0x7fffffffdb48) at bytecode.c:632
#20 0x0000000000569541 in fetch_and_exec_byte_code
     (args=0x7fffffffdb48, nargs=1, syms_left=0x1006, fun=0x7ffff18644a5)
     at /home/jos/temp_emacs/emacs-28.1/src/lisp.h:1853
#21 funcall_lambda
     (fun=0x7ffff18644a5, nargs=nargs@entry=1, 
arg_vector=arg_vector@entry=0x7fffffffdb48)
     at eval.c:3228
#22 0x0000000000566d69 in Ffuncall (nargs=nargs@entry=2, 
args=args@entry=0x7fffffffdb40)
     at eval.c:3027
#23 0x0000000000566f19 in call1 (fn=fn@entry=0x4590, arg1=<optimized 
out>) at eval.c:2883
#24 0x0000000000502a36 in command_loop_1 () at keyboard.c:1505
#25 0x000000000056612d in internal_condition_case
     (bfun=bfun@entry=0x5023eb <command_loop_1>, 
handlers=handlers@entry=0x90, hfun=hfun@entry=0x4f7da1 <cmd_error>) at 
eval.c:1450
#26 0x00000000004f4841 in command_loop_2 (handlers=handlers@entry=0x90)
     at keyboard.c:1133
#27 0x00000000005660a4 in internal_catch
     (tag=tag@entry=0xe850, func=func@entry=0x4f482b <command_loop_2>, 
arg=arg@entry=0x90)
     at eval.c:1181
#28 0x00000000004f480d in command_loop () at keyboard.c:1111
#29 0x00000000004f7a2e in recursive_edit_1 () at keyboard.c:720
#30 0x00000000004f7cf9 in Frecursive_edit () at keyboard.c:803
#31 0x00000000004f3d72 in main (argc=3, argv=0x7fffffffdfd8) at emacs.c:2354

>> Ffuncall (nargs=1, args=args@entry=0x7fffffffd258) at eval.c:3048
>> 3048      lisp_eval_depth--;
> 
> You see, FRAME_ICONIFIED_P doesn't call Ffuncall, and there's no such
> call anywhere in sight inside x_iconify_frame.  So either the macro
> FRAME_ICONIFIED_P somehow signaled an error (which I don't think can
> happen), or something else kicked us out of the function when we tried
> to see if the frame is already iconified.  The question is: what did
> kick us out and why?