Fix error during DND from both Emacs and GTK at the same time

* src/xterm.c (x_dnd_get_target_window): Make mapping and
releasing the COW atomic.  This is to fix a rare bug when
MPX (multi-pointer X) is in use and the user tries to drag
from both GTK and Emacs at the same time using multiple seats.
This commit is contained in:
Po Lu 2022-06-04 20:00:40 +08:00
parent f76f529524
commit fe6f1dfeb4

View file

@ -3524,10 +3524,13 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo,
dpyinfo->Xatom_NET_WM_CM_Sn) != None)
{
x_catch_errors (dpyinfo->display);
XGrabServer (dpyinfo->display);
overlay_window = XCompositeGetOverlayWindow (dpyinfo->display,
dpyinfo->root_window);
XCompositeReleaseOverlayWindow (dpyinfo->display,
dpyinfo->root_window);
XUngrabServer (dpyinfo->display);
if (!x_had_errors_p (dpyinfo->display))
{
XGetWindowAttributes (dpyinfo->display, overlay_window, &attrs);
@ -3682,10 +3685,13 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo,
dpyinfo->Xatom_NET_WM_CM_Sn) != None)
{
x_catch_errors (dpyinfo->display);
XGrabServer (dpyinfo->display);
overlay_window = XCompositeGetOverlayWindow (dpyinfo->display,
dpyinfo->root_window);
XCompositeReleaseOverlayWindow (dpyinfo->display,
dpyinfo->root_window);
XUngrabServer (dpyinfo->display);
if (!x_had_errors_p (dpyinfo->display))
{
XGetWindowAttributes (dpyinfo->display, overlay_window, &attrs);