GNU bug report logs - #63614
29.0.91; PGTK Emacs crashes after clearing the clipboard

Previous Next

Package: emacs;

Reported by: Leonardo Hernández <leohdz172 <at> proton.me>

Date: Sat, 20 May 2023 19:51:01 UTC

Severity: normal

Found in version 29.0.91

Full log


Message #44 received at 63614 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Leonardo Hernández Hernández <leohdz172 <at> proton.me>
Cc: 63614 <at> debbugs.gnu.org
Subject: Re: bug#63614: 29.0.91; PGTK Emacs crashes after clearing the
 clipboard
Date: Fri, 26 May 2023 08:33:52 +0800
Leonardo Hernández Hernández <leohdz172 <at> proton.me> writes:

> On Thu, May 25, 2023 at 04:35:56AM -0600, Po Lu wrote:
>> OK, thanks.  Does the crash still happen with this?
>> 
>> diff --git a/src/pgtkterm.c b/src/pgtkterm.c
>> index b8c626d81d8..bbe68f04adc 100644
>> --- a/src/pgtkterm.c
>> +++ b/src/pgtkterm.c
>> @@ -6606,8 +6606,7 @@ pgtk_selection_event (GtkWidget *widget, GdkEvent *event,
>> 
>>    if (event->type == GDK_PROPERTY_NOTIFY)
>>      pgtk_handle_property_notify (&event->property);
>> -  else if (event->type == GDK_SELECTION_CLEAR
>> -	   || event->type == GDK_SELECTION_REQUEST)
>> +  else if (event->type == GDK_SELECTION_REQUEST)
>>      {
>>        f = pgtk_find_selection_owner (event->selection.window);
>> 
>
> The crash does not happen when copying text from outside emacs,
> however it crashes when pasting text killed from emacs,
> for example, open `emacs -Q` kill some text and try to paste that
> text outside emacs (just run `wl-paste`)

What if you apply this change?

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index b8c626d81d8..bfad949941b 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -376,11 +376,16 @@ mark_pgtkterm (void)
   for (i = 0; i < n; i++)
     {
       union buffered_input_event *ev = &evq->q[i];
-      mark_object (ev->ie.x);
-      mark_object (ev->ie.y);
-      mark_object (ev->ie.frame_or_window);
-      mark_object (ev->ie.arg);
-      mark_object (ev->ie.device);
+
+      if (ev->ie.type != SELECTION_CLEAR_EVENT
+	  && ev->ie.type != SELECTION_REQUEST_EVENT)
+	{
+	  mark_object (ev->ie.x);
+	  mark_object (ev->ie.y);
+	  mark_object (ev->ie.frame_or_window);
+	  mark_object (ev->ie.arg);
+	  mark_object (ev->ie.device);
+	}
     }
 
   for (dpyinfo = x_display_list; dpyinfo;




This bug report was last modified 2 years and 22 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.