emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 143548fdd6: Don't sync for errors setting up DND targets and topl


From: Po Lu
Subject: master 143548fdd6: Don't sync for errors setting up DND targets and toplevels
Date: Sun, 10 Jul 2022 01:23:08 -0400 (EDT)

branch: master
commit 143548fdd6c732ce6bf628d239137297bc373616
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Don't sync for errors setting up DND targets and toplevels
    
    * src/xterm.c (xm_setup_dnd_targets, x_dnd_free_toplevels)
    (x_dnd_compute_toplevels): Avoid catching errors synchronously.
---
 src/xterm.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 4e2d977e60..e7e6ca7bf8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2085,7 +2085,7 @@ xm_setup_dnd_targets (struct x_display_info *dpyinfo,
                           &actual_type, &actual_format, &nitems,
                           &bytes_remaining, &tmp_data) == Success;
   had_errors = x_had_errors_p (dpyinfo->display);
-  x_uncatch_errors ();
+  x_uncatch_errors_after_check ();
 
   /* The drag window is probably invalid, so remove our record of
      it.  */
@@ -2798,6 +2798,7 @@ x_dnd_free_toplevels (bool display_alive)
   unsigned long *prev_masks;
   specpdl_ref count;
   Display *dpy;
+  struct x_display_info *dpyinfo;
 
   if (!x_dnd_toplevels)
     /* Probably called inside an IO error handler.  */
@@ -2865,17 +2866,22 @@ x_dnd_free_toplevels (bool display_alive)
 
   if (display_alive)
     {
-      x_catch_errors (dpy);
+      dpyinfo = x_display_info_for_display (dpy);
 
-      for (i = 0; i < n_windows; ++i)
+      if (n_windows)
        {
-         XSelectInput (dpy, destroy_windows[i], prev_masks[i]);
+         x_ignore_errors_for_next_request (dpyinfo);
+
+         for (i = 0; i < n_windows; ++i)
+           {
+             XSelectInput (dpy, destroy_windows[i], prev_masks[i]);
 #ifdef HAVE_XSHAPE
-         XShapeSelectInput (dpy, destroy_windows[i], None);
+             XShapeSelectInput (dpy, destroy_windows[i], None);
 #endif
-       }
+           }
 
-      x_uncatch_errors ();
+         x_stop_ignoring_errors (dpyinfo);
+       }
     }
 
   unbind_to (count, Qnil);
@@ -3389,12 +3395,12 @@ x_dnd_compute_toplevels (struct x_display_info *dpyinfo)
            }
 #endif
 
-         x_catch_errors (dpyinfo->display);
+         x_ignore_errors_for_next_request (dpyinfo);
          XSelectInput (dpyinfo->display, toplevels[i],
                        (attrs.your_event_mask
                         | StructureNotifyMask
                         | PropertyChangeMask));
-         x_uncatch_errors ();
+         x_stop_ignoring_errors (dpyinfo);
 
          x_dnd_toplevels = tem;
        }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]