diff options
| author | Po Lu | 2022-03-24 16:59:03 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-24 17:00:43 +0800 |
| commit | f09e68e1806904709adf4003146638aee718b980 (patch) | |
| tree | be919d0156cec63833ca8b469299b43326046cb7 | |
| parent | 9856290806a449d35380135adabd607b6612dd98 (diff) | |
| download | emacs-f09e68e1806904709adf4003146638aee718b980.tar.gz emacs-f09e68e1806904709adf4003146638aee718b980.zip | |
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.
| -rw-r--r-- | src/xterm.c | 4 |
1 files changed, 4 insertions, 0 deletions
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, | |||
| 7001 | prop.format = 8; | 7001 | prop.format = 8; |
| 7002 | prop.nitems = end; | 7002 | prop.nitems = end; |
| 7003 | 7003 | ||
| 7004 | block_input (); | ||
| 7004 | XSetTextProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 7005 | XSetTextProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 7005 | &prop, FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); | 7006 | &prop, FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); |
| 7006 | xfree (ask_actions); | 7007 | xfree (ask_actions); |
| @@ -7009,6 +7010,7 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 7009 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList, XA_ATOM, 32, | 7010 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList, XA_ATOM, 32, |
| 7010 | PropModeReplace, (unsigned char *) ask_action_list, | 7011 | PropModeReplace, (unsigned char *) ask_action_list, |
| 7011 | n_ask_actions); | 7012 | n_ask_actions); |
| 7013 | unblock_input (); | ||
| 7012 | } | 7014 | } |
| 7013 | else | 7015 | else |
| 7014 | { | 7016 | { |
| @@ -7016,10 +7018,12 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, | |||
| 7016 | and not the action to decide whether or not the user should | 7018 | and not the action to decide whether or not the user should |
| 7017 | be prompted to select an action. */ | 7019 | be prompted to select an action. */ |
| 7018 | 7020 | ||
| 7021 | block_input (); | ||
| 7019 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 7022 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 7020 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList); | 7023 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionList); |
| 7021 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 7024 | XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 7022 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); | 7025 | FRAME_DISPLAY_INFO (f)->Xatom_XdndActionDescription); |
| 7026 | unblock_input (); | ||
| 7023 | } | 7027 | } |
| 7024 | 7028 | ||
| 7025 | x_dnd_in_progress = true; | 7029 | x_dnd_in_progress = true; |