bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63614: 29.0.91; PGTK Emacs crashes after clearing the clipboard


From: Po Lu
Subject: bug#63614: 29.0.91; PGTK Emacs crashes after clearing the clipboard
Date: Fri, 26 May 2023 08:33:52 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Leonardo Hernández Hernández <leohdz172@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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]