diff options
| author | Po Lu | 2022-07-04 14:02:42 +0800 |
|---|---|---|
| committer | Po Lu | 2022-07-04 14:02:42 +0800 |
| commit | c4e93b67c456b2a7cfc57b13c5d8070eb2b6d167 (patch) | |
| tree | a5ae2a8f2cd88d08467614f83daa06ab5090addf /src | |
| parent | 1da6a6d3271be003b545e41ae21c3071faf22f86 (diff) | |
| download | emacs-c4e93b67c456b2a7cfc57b13c5d8070eb2b6d167.tar.gz emacs-c4e93b67c456b2a7cfc57b13c5d8070eb2b6d167.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index de8e973173f..e242768c95d 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -23144,6 +23144,19 @@ static void | |||
| 23144 | x_ignore_errors_for_next_request (struct x_display_info *dpyinfo) | 23144 | x_ignore_errors_for_next_request (struct x_display_info *dpyinfo) |
| 23145 | { | 23145 | { |
| 23146 | struct x_failable_request *request, *max; | 23146 | struct x_failable_request *request, *max; |
| 23147 | #ifdef HAVE_GTK3 | ||
| 23148 | GdkDisplay *gdpy; | ||
| 23149 | |||
| 23150 | /* GTK 3 tends to override our own error handler inside certain | ||
| 23151 | callbacks, which this can be called from. Instead of trying to | ||
| 23152 | restore our own, add a trap for the following requests with | ||
| 23153 | GDK as well. */ | ||
| 23154 | |||
| 23155 | gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); | ||
| 23156 | |||
| 23157 | if (gdpy) | ||
| 23158 | gdk_x11_display_error_trap_push (gdpy); | ||
| 23159 | #endif | ||
| 23147 | 23160 | ||
| 23148 | if ((dpyinfo->next_failable_request | 23161 | if ((dpyinfo->next_failable_request |
| 23149 | != dpyinfo->failable_requests) | 23162 | != dpyinfo->failable_requests) |
| @@ -23182,6 +23195,9 @@ static void | |||
| 23182 | x_stop_ignoring_errors (struct x_display_info *dpyinfo) | 23195 | x_stop_ignoring_errors (struct x_display_info *dpyinfo) |
| 23183 | { | 23196 | { |
| 23184 | struct x_failable_request *range; | 23197 | struct x_failable_request *range; |
| 23198 | #ifdef HAVE_GTK3 | ||
| 23199 | GdkDisplay *gdpy; | ||
| 23200 | #endif | ||
| 23185 | 23201 | ||
| 23186 | range = dpyinfo->next_failable_request - 1; | 23202 | range = dpyinfo->next_failable_request - 1; |
| 23187 | range->end = XNextRequest (dpyinfo->display) - 1; | 23203 | range->end = XNextRequest (dpyinfo->display) - 1; |
| @@ -23192,6 +23208,13 @@ x_stop_ignoring_errors (struct x_display_info *dpyinfo) | |||
| 23192 | if (X_COMPARE_SERIALS (range->end, <, | 23208 | if (X_COMPARE_SERIALS (range->end, <, |
| 23193 | range->start)) | 23209 | range->start)) |
| 23194 | emacs_abort (); | 23210 | emacs_abort (); |
| 23211 | |||
| 23212 | #ifdef HAVE_GTK3 | ||
| 23213 | gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display); | ||
| 23214 | |||
| 23215 | if (gdpy) | ||
| 23216 | gdk_x11_display_error_trap_pop_ignored (gdpy); | ||
| 23217 | #endif | ||
| 23195 | } | 23218 | } |
| 23196 | 23219 | ||
| 23197 | /* Undo the last x_catch_errors call. | 23220 | /* Undo the last x_catch_errors call. |