Subject: Re: bug#70073: 29.3; Emacs-PGTK crashes upon marking some text inside emacs and then middle clicking outside of Emacs

From: Eli Zaretskii <[email-masked]>
Date: Fri, 12 Apr 2024 22:07:52 +0300

> Date: Fri, 12 Apr 2024 20:41:02 +0200 (CEST)
> From: "Abraham S.A.H." <[email-masked]>
> Cc: 70073 <[email-masked]>
> 
> Thread 1 (Thread 0x7ffff2090080 (LWP 60645) "emacs"):
> #0  pgtk_handle_selection_request (event=0x7fffffffc040) at /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c:573
> #1  0x00005555556fbc8d in pgtk_handle_selection_event (event=0x7fffffffc040) at /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c:784
> #2  process_special_events () at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:4449
> #3  0x00005555556fcd91 in swallow_events (do_display=true) at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:4489
> #4  0x0000555555831607 in wait_reading_process_output (time_limit=<optimized out>, nsecs=<optimized out>, read_kbd=<optimized out>, do_display=<optimized out>, wait_for_cell=<optimized out>, wait_proc=<optimized out>, just_wait_proc=<optimized out>) at /usr/src/debug/emacs/emacs-29.3-wayland/src/process.c:5788
> #5  0x00005555555eea46 in sit_for (timeout=<optimized out>, reading=<optimized out>, display_option=<optimized out>) at /usr/src/debug/emacs/emacs-29.3-wayland/src/dispnew.c:6264
> #6  0x0000555555705551 in read_char (commandflag=1, map=0x555556dc40f3, prev_event=0x0, used_mouse_menu=0x7fffffffcb6b, end_time=0x0) at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:2881
> #7  0x00005555558d7de7 in read_key_sequence.constprop.0 (keybuf=<optimized out>, prevent_redisplay=false, fix_current_buffer=<optimized out>, can_return_switch_frame=<optimized out>, dont_downcase_last=<optimized out>, prompt=<optimized out>) at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:10084
> #8  0x00005555556f50f4 in command_loop_1 () at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:1384
> #9  0x00005555557b50df in internal_condition_case (bfun=0x5555556f4e20 <command_loop_1>, handlers=<optimized out>, hfun=0x5555556f2890 <cmd_error>) at /usr/src/debug/emacs/emacs-29.3-wayland/src/eval.c:1474
> #10 0x00005555556f2b6e in command_loop_2 (handlers=handlers@entry=0x90) at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:1133
> #11 0x00005555557b5035 in internal_catch (tag=<optimized out>, func=0x5555556f2b40 <command_loop_2>, arg=0x90) at /usr/src/debug/emacs/emacs-29.3-wayland/src/eval.c:1197
> #12 0x00005555556f48f9 in command_loop () at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:1111
> #13 0x000055555590ceb0 in recursive_edit_1.isra.0 () at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:720
> #14 0x00005555556f4e00 in Frecursive_edit () at /usr/src/debug/emacs/emacs-29.3-wayland/src/keyboard.c:803
> #15 0x00005555556fa777 in main (argc=<optimized out>, argv=0x7fffffffd278) at /usr/src/debug/emacs/emacs-29.3-wayland/src/emacs.c:2521

Thanks.

Po Lu, any idea why pgtk_handle_selection_request segfaults at that
point?  Is dpyinfo or dpyinfo->terminal a NULL or invalid pointer or
something?