diff options
author | Po Lu <luangruo@yahoo.com> | 2022-11-19 18:46:07 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-11-19 18:47:28 +0800 |
commit | 07127e9c29a7d467f951f2ff939aae62ad744302 (patch) | |
tree | a8073c6ed9c895cd5f5437fbfbf4fd3685758888 /src/xfns.c | |
parent | 4a2e3d19f72764c6724b5f126fd2618e99860153 (diff) | |
download | emacs-07127e9c29a7d467f951f2ff939aae62ad744302.tar.gz |
Fix error trapping in x_set_mouse_color
* src/xfns.c (x_set_mouse_color): Use
x_uncatch_errors_after_check right after x_had_errors_p. Then,
trap errors around FreeCursor requests, since some of the IDs
may not name valid cursors.
Diffstat (limited to 'src/xfns.c')
-rw-r--r-- | src/xfns.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/xfns.c b/src/xfns.c index 2ff70f79851..95092ce05f4 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1362,13 +1362,21 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) char *xmessage = alloca (1 + message_length); memcpy (xmessage, cursor_data.error_string, message_length); - x_uncatch_errors (); + x_uncatch_errors_after_check (); + + /* XFreeCursor can generate BadCursor errors, because + XCreateFontCursor is not a request that waits for a reply, + and as such can return IDs that will not actually be used by + the server. */ + x_ignore_errors_for_next_request (FRAME_DISPLAY_INFO (f)); /* Free any successfully created cursors. */ for (i = 0; i < mouse_cursor_max; i++) if (cursor_data.cursor[i] != 0) XFreeCursor (dpy, cursor_data.cursor[i]); + x_stop_ignoring_errors (FRAME_DISPLAY_INFO (f)); + /* This should only be able to fail if the server's serial number tracking is broken. */ if (cursor_data.error_cursor >= 0) |