emacs-diffs
[Top][All Lists]
Advanced

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

master 5ad6a08a2e: Prevent race conditions with async input during drag-


From: Po Lu
Subject: master 5ad6a08a2e: Prevent race conditions with async input during drag-and-drop
Date: Sat, 16 Apr 2022 07:13:47 -0400 (EDT)

branch: master
commit 5ad6a08a2eb5a57520f0c954a76c19f28d00ae9d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Prevent race conditions with async input during drag-and-drop
    
    * src/xterm.c (XTread_socket): Don't read events here during
    drag-and-drop, otherwise the right hold_quit might not be used
    for selection events.
---
 src/xterm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index dc33ba7556..b65de88674 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -18968,6 +18968,13 @@ XTread_socket (struct terminal *terminal, struct 
input_event *hold_quit)
   bool event_found = false;
   struct x_display_info *dpyinfo = terminal->display_info.x;
 
+  /* Don't allow XTread_socket to do anything if drag-and-drop is in
+     progress.  If unblock_input causes XTread_socket to be called and
+     read X events while the drag-and-drop event loop is in progress,
+     things can go wrong very quick.  */
+  if (x_dnd_in_progress || x_dnd_waiting_for_finish)
+    return 0;
+
   block_input ();
 
   /* For debugging, this gives a way to fake an I/O error.  */



reply via email to

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