[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master c4e93b67c4 2/2: Handle errors caused by ignoring errors with GDK'
From: |
Po Lu |
Subject: |
master c4e93b67c4 2/2: Handle errors caused by ignoring errors with GDK's trap installed |
Date: |
Mon, 4 Jul 2022 02:06:29 -0400 (EDT) |
branch: master
commit c4e93b67c456b2a7cfc57b13c5d8070eb2b6d167
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Handle errors caused by ignoring errors with GDK's trap installed
* src/xterm.c (x_ignore_errors_for_next_request)
(x_stop_ignoring_errors): Also tell GDK to ignore errors from
the following requests. (bug#56372)
---
src/xterm.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/xterm.c b/src/xterm.c
index de8e973173..e242768c95 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -23144,6 +23144,19 @@ static void
x_ignore_errors_for_next_request (struct x_display_info *dpyinfo)
{
struct x_failable_request *request, *max;
+#ifdef HAVE_GTK3
+ GdkDisplay *gdpy;
+
+ /* GTK 3 tends to override our own error handler inside certain
+ callbacks, which this can be called from. Instead of trying to
+ restore our own, add a trap for the following requests with
+ GDK as well. */
+
+ gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
+
+ if (gdpy)
+ gdk_x11_display_error_trap_push (gdpy);
+#endif
if ((dpyinfo->next_failable_request
!= dpyinfo->failable_requests)
@@ -23182,6 +23195,9 @@ static void
x_stop_ignoring_errors (struct x_display_info *dpyinfo)
{
struct x_failable_request *range;
+#ifdef HAVE_GTK3
+ GdkDisplay *gdpy;
+#endif
range = dpyinfo->next_failable_request - 1;
range->end = XNextRequest (dpyinfo->display) - 1;
@@ -23192,6 +23208,13 @@ x_stop_ignoring_errors (struct x_display_info *dpyinfo)
if (X_COMPARE_SERIALS (range->end, <,
range->start))
emacs_abort ();
+
+#ifdef HAVE_GTK3
+ gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
+
+ if (gdpy)
+ gdk_x11_display_error_trap_pop_ignored (gdpy);
+#endif
}
/* Undo the last x_catch_errors call.