emacs-diffs
[Top][All Lists]
Advanced

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

master f09e68e180: Avoid crashes if async input arrives when setting pro


From: Po Lu
Subject: master f09e68e180: Avoid crashes if async input arrives when setting properties for DND
Date: Thu, 24 Mar 2022 05:00:54 -0400 (EDT)

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

    Avoid crashes if async input arrives when setting properties for DND
    
    * src/xterm.c (x_dnd_begin_drag_and_drop): Block input around
    non-async signal safe functions.
---
 src/xterm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index 33165c27a7..d271c7190d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7001,6 +7001,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, 
Atom xaction,
       prop.format = 8;
       prop.nitems = end;
 
+      block_input ();
       XSetTextProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                        &prop, FRAME_DISPLAY_INFO 
(f)->Xatom_XdndActionDescription);
       xfree (ask_actions);
@@ -7009,6 +7010,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, 
Atom xaction,
                       FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList, XA_ATOM, 
32,
                       PropModeReplace, (unsigned char *) ask_action_list,
                       n_ask_actions);
+      unblock_input ();
     }
   else
     {
@@ -7016,10 +7018,12 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, 
Atom xaction,
         and not the action to decide whether or not the user should
         be prompted to select an action.  */
 
+      block_input ();
       XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                       FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList);
       XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                       FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription);
+      unblock_input ();
     }
 
   x_dnd_in_progress = true;



reply via email to

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