From d861de72289464e336c772f1741016a90a2118c5 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 12 Jul 2023 18:07:53 +0800 Subject: [PATCH] Minor correction to X error handling * src/xterm.c (x_error_handler): Clear fail->selection_serial after reporting an error during selection transfer, in case any other outstanding requests within the protected section also report errors. --- src/xterm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index d65a6829b45..9ecead03b08 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -26439,9 +26439,18 @@ x_error_handler (Display *display, XErrorEvent *event) /* If a selection transfer is the cause of this error, remove the selection transfer now. */ + if (fail->selection_serial) - x_handle_selection_error (fail->selection_serial, - event); + { + x_handle_selection_error (fail->selection_serial, + event); + + /* Clear selection_serial to prevent + x_handle_selection_error from being called again if + any more requests within the protected section cause + errors to be reported. */ + fail->selection_serial = 0; + } return 0; } -- 2.39.2