From: Po Lu Date: Thu, 24 Mar 2022 08:59:03 +0000 (+0800) Subject: Avoid crashes if async input arrives when setting properties for DND X-Git-Tag: emacs-29.0.90~1931^2~943 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f09e68e1806904709adf4003146638aee718b980;p=emacs.git 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. --- diff --git a/src/xterm.c b/src/xterm.c index 33165c27a76..d271c7190d4 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;