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.
This commit is contained in:
Po Lu 2022-03-19 18:46:50 +08:00
parent 2f1fbf20ad
commit c79e0188e8

View file

@ -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