From: Po Lu Date: Sat, 19 Mar 2022 10:46:50 +0000 (+0800) Subject: Improve protection against faulty clients during DND X-Git-Tag: emacs-29.0.90~1931^2~1039^2~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c79e0188e849715a7c4dc306c93ad8d0b3517d32;p=emacs.git Improve protection against faulty clients during DND * src/xterm.c (x_dnd_send_enter, x_dnd_send_position) (xdnd_send_leave, x_dnd_send_drop): Catch errors around call to XSendEvent. The target window could be gone. --- diff --git a/src/xterm.c b/src/xterm.c index b820c102f1b..fb0fc66ae59 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1035,7 +1035,9 @@ x_dnd_send_enter (struct frame *f, Window target, int supported) PropModeReplace, (unsigned char *) x_dnd_targets, x_dnd_n_targets); + x_catch_errors (dpyinfo->display); XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + x_uncatch_errors (); } static void @@ -1075,7 +1077,9 @@ x_dnd_send_position (struct frame *f, Window target, int supported, if (supported >= 4) msg.xclient.data.l[4] = action; + x_catch_errors (dpyinfo->display); XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + x_uncatch_errors (); } static void @@ -1094,7 +1098,9 @@ x_dnd_send_leave (struct frame *f, Window target) msg.xclient.data.l[3] = 0; msg.xclient.data.l[4] = 0; + x_catch_errors (dpyinfo->display); XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + x_uncatch_errors (); } static void @@ -1117,7 +1123,9 @@ x_dnd_send_drop (struct frame *f, Window target, Time timestamp, if (supported >= 1) msg.xclient.data.l[2] = timestamp; + x_catch_errors (dpyinfo->display); XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + x_uncatch_errors (); } void