Subject: 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 14:07:24 +0300

> Date: Fri, 12 Apr 2024 11:54:50 +0200 (CEST)
> From: "Abraham S.A.H." <[email-masked]>
> Cc: 70073 <[email-masked]>
> 
> Sorry for delay.
> 
> I got the opportunity to build Arch's `emacs-wayland` package myself, from the same PKGBUILD file used to build it in Arch's official repositories, including debug and without stripping anything. The result was about 30mg increase in size of the final built Emacs.  And the issue still persist.

The increase of the executable size is because it includes debug info.

> $ gdb emacs
> GNU gdb (GDB) 14.2
> Copyright (C) 2023 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-pc-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>.
> 
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from emacs...
> (gdb) r -Q
> Starting program: /usr/bin/emacs -Q
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/usr/lib/libthread_db.so.1".
> [New Thread 0x7fffeda006c0 (LWP 7410)]
> [New Thread 0x7fffed0006c0 (LWP 7411)]
> [New Thread 0x7fffe7e006c0 (LWP 7412)]
> [New Thread 0x7fffe74006c0 (LWP 7413)]
> [New Thread 0x7fffe6a006c0 (LWP 7414)]
> [New Thread 0x7fffe54006c0 (LWP 7415)]
> [Detaching after vfork from child process 7435]
> 
> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
> pgtk_handle_selection_request (event=0x7fffffffbe80)
>     at /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c:573
> warning: 573    /usr/src/debug/emacs/emacs-29.3-wayland/src/pgtkselect.c: No such file or directory

At this point, please type at the GDB prompt:

  thread apply all bt

and post the backtrace produced by GDB.  That's the information we
need to try to figure out what causes these crashes.