Subject: bug#75056: 31.0.50; tty-child-frames with server / multiple clients possible hangs

From: Len Trigg <[email-masked]>
Date: Sat, 25 Jan 2025 08:19:20 +1300

BTW, I triggered another segfault (this time I had two terminal clients and
one gui client and was cycling focus between them):

0x00005555555bdf65 in is_in_matrix (y=48, x=2297, f=0x555556f60048) at
dispnew.c:3893
3893      if (x < 0 || x >= root->current_matrix->matrix_w || y < 0
(gdb) where
#0  0x00005555555bdf65 in is_in_matrix (y=48, x=2297, f=0x555556f60048) at
dispnew.c:3893
#1  is_cursor_obscured () at dispnew.c:3913
#2  terminal_cursor_magic (topmost_child=0x555556c1e900,
root=0x555556bacd08) at dispnew.c:3932
#3  combine_updates_for_frame (f=<optimized out>,
inhibit_scrolling=inhibit_scrolling@entry=false) at dispnew.c:3997
#4  0x00005555555be0f3 in combine_updates (roots=roots@entry=0x7fffec960b33)
at dispnew.c:4023
#5  0x00005555556054f6 in redisplay_internal () at xdisp.c:17599
#6  0x0000555555606fe9 in redisplay () at xdisp.c:16656
#7  0x00005555556f25ba in read_char (commandflag=1,
map=map@entry=0x7fffec962463,
prev_event=0x0, used_mouse_menu=used_mouse_menu@entry=0x7fffffffc6ab,
end_time=end_time@entry=0x0)
    at keyboard.c:2672
#8  0x00005555556f5ad7 in read_key_sequence
    (keybuf=keybuf@entry=0x7fffffffc800, prompt=prompt@entry=0x0,
dont_downcase_last=dont_downcase_last@entry=false,
can_return_switch_frame=can_return_switch_frame@entry=true,
fix_current_buffer=fix_current_buffer@entry=true,
prevent_redisplay=prevent_redisplay@entry=false,
disable_text_conversion_p=false) at keyboard.c:10746
#9  0x00005555556f7734 in command_loop_1 () at keyboard.c:1424
#10 0x0000555555775607 in internal_condition_case
(bfun=bfun@entry=0x5555556f7570
<command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x5555556eb190
<cmd_error>) at eval.c:1607
#11 0x00005555556e2cfe in command_loop_2 (handlers=handlers@entry=0x90) at
keyboard.c:1163
#12 0x0000555555775549 in internal_catch (tag=tag@entry=0x12360,
func=func@entry=0x5555556e2cd0 <command_loop_2>, arg=arg@entry=0x90) at
eval.c:1286
#13 0x00005555556e2c91 in command_loop () at keyboard.c:1141
#14 0x00005555556ead05 in recursive_edit_1 () at keyboard.c:749
#15 0x00005555556eb0a4 in Frecursive_edit () at keyboard.c:832
#16 0x00005555555b4e3f in main (argc=3, argv=<optimized out>) at
emacs.c:2628

On Fri, 24 Jan 2025 at 22:32, Gerd Möllmann <[email-masked]>
wrote:

> Len Trigg <[email-masked]> writes:
>
> > OK, that's fixed the crash, but my original problem persists, with a
> > new artifact. This time slightly different repro steps to make things
> > more visible:
>
> Okay, that's what I intended to fix. Thanks for the feedback.
>
> I think the rest of the behavior is somehow multi-tty. We talked about
> that already. I don't think I'll tackle that, sorry.
>
> >
> > - Open two terminal windows side by side
>
> > - In the first terminal: emacs -nw --init-directory=~/emacs-test
> > (using the original init.el I sent)
>
> > - In the second terminal: emacsclient -nw, followed by C-x b C-n RET
> > (to switch buffers using tty child frame, leaving the cursor in
> > *Messages* and the tty child frame has been dismissed)
>
> > - Back to the first terminal: C-x b C-n RET (as above, this switches
> > buffers using the tty child frame, leaving the cursor in *Messages*
> > and the tty child frame has been dismissed.
>
> > - Now, notice that immediately upon switching focus back to the second
> > terminal (I use focus follows mouse) we find the emacsclient "hung",
> > but back on the first terminal the tty child frame has magically
> > represented itself even though it had been dismissed!!!
>
> > - If we move the mouse focus back to the first terminal, the tty child
> > frame disappears.
> >
> > On Fri, 24 Jan 2025 at 18:26, Gerd Möllmann <[email-masked]>
> wrote:
> >
> >  Gerd Möllmann <[email-masked]> writes:
> >
> >  > Anyway. I'll develop a fix for that immediate problem tomorrow. I
> think
> >  > I'll just make it not crash for now, and perform the update anyway,
> >  > which I guess 30 would do.
> >
> >  Pushed to master.
>