emacs-diffs
[Top][All Lists]
Advanced

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

master f9da45df47: Prevent races when trying to set Motif drag window


From: Po Lu
Subject: master f9da45df47: Prevent races when trying to set Motif drag window
Date: Wed, 6 Apr 2022 05:18:36 -0400 (EDT)

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

    Prevent races when trying to set Motif drag window
    
    * src/xterm.c (xm_get_drag_window): Grab temp connection when
    setting the drag window.
---
 src/xterm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/xterm.c b/src/xterm.c
index 7eef2b488b..b6aed004ed 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1395,13 +1395,18 @@ xm_get_drag_window (struct x_display_info *dpyinfo)
 
   if (drag_window == None)
     {
+      block_input ();
       unrequest_sigio ();
       temp_display = XOpenDisplay (XDisplayString (dpyinfo->display));
       request_sigio ();
 
       if (!temp_display)
-       return None;
+       {
+         unblock_input ();
+         return None;
+       }
 
+      XGrabServer (temp_display);
       XSetCloseDownMode (temp_display, RetainPermanent);
       attrs.override_redirect = True;
       drag_window = XCreateWindow (temp_display, DefaultRootWindow 
(temp_display),
@@ -1422,6 +1427,7 @@ xm_get_drag_window (struct x_display_info *dpyinfo)
                            drag_window, &wattrs);
       rc = !x_had_errors_p (dpyinfo->display);
       x_uncatch_errors_after_check ();
+      unblock_input ();
 
       /* We connected to the wrong display, so just give up.  */
       if (!rc)



reply via email to

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