emacs-diffs
[Top][All Lists]
Advanced

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

master 3e00e50ee3d: Fix potential crash deselecting for property change


From: Po Lu
Subject: master 3e00e50ee3d: Fix potential crash deselecting for property change notifications
Date: Sun, 4 Dec 2022 08:56:34 -0500 (EST)

branch: master
commit 3e00e50ee3d54537b8390b8d386387d01ae7553d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix potential crash deselecting for property change notifications
    
    * src/xselect.c (x_cancel_selection_transfer): Catch errors
    around XSelectInput.
---
 src/xselect.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/xselect.c b/src/xselect.c
index 120a5a163e2..121b17df1b0 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -794,8 +794,16 @@ x_cancel_selection_transfer (struct transfer *transfer)
                                    transfer->requestor)
       /* This can be called from x_delete_display.  */
       && transfer->dpyinfo->display)
-    XSelectInput (transfer->dpyinfo->display,
-                 transfer->requestor, NoEventMask);
+    {
+      /* Ignore errors generated by the change window request in case
+        the window has gone away.  */
+      block_input ();
+      x_ignore_errors_for_next_request (transfer->dpyinfo);
+      XSelectInput (transfer->dpyinfo->display,
+                   transfer->requestor, NoEventMask);
+      x_stop_ignoring_errors (transfer->dpyinfo);
+      unblock_input ();
+    }
 
   cancel_atimer (transfer->timeout);
   xfree (transfer);



reply via email to

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