emacs-diffs
[Top][All Lists]
Advanced

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

master f803203088c: Work around sample server bug


From: Po Lu
Subject: master f803203088c: Work around sample server bug
Date: Tue, 6 Dec 2022 06:30:43 -0500 (EST)

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

    Work around sample server bug
    
    * src/xterm.c (XTring_bell): Catch Access errors from XBell when
    Emacs is running as an untrusted client.
---
 src/xterm.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index ab31f0d93e6..f446d093ef4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11251,21 +11251,32 @@ XTflash (struct frame *f)
 static void
 XTring_bell (struct frame *f)
 {
-  if (FRAME_X_DISPLAY (f))
+  struct x_display_info *dpyinfo;
+
+  if (!FRAME_X_DISPLAY (f))
+    return;
+
+  dpyinfo = FRAME_DISPLAY_INFO (f);
+
+  if (visible_bell)
+    XTflash (f);
+  else
     {
-      if (visible_bell)
-       XTflash (f);
-      else
-       {
-         block_input ();
+      /* When Emacs is untrusted, Bell requests sometimes generate
+        Access errors.  This is not in the security extension
+        specification but seems to be a bug in the X consortium XKB
+        implementation.  */
+
+      block_input ();
+      x_ignore_errors_for_next_request (dpyinfo);
 #ifdef HAVE_XKB
-          XkbBell (FRAME_X_DISPLAY (f), None, 0, None);
+      XkbBell (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, None);
 #else
-         XBell (FRAME_X_DISPLAY (f), 0);
+      XBell (FRAME_X_DISPLAY (f), 0);
 #endif
-         XFlush (FRAME_X_DISPLAY (f));
-         unblock_input ();
-       }
+      XFlush (FRAME_X_DISPLAY (f));
+      x_stop_ignoring_errors (dpyinfo);
+      unblock_input ();
     }
 }
 



reply via email to

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