From 9668fa94814509cd5679185cc757f3c0a0c17ec6 Mon Sep 17 00:00:00 2001 From: Sean Estabrooks Date: Sat, 14 Sep 2024 11:27:08 -0400 Subject: [PATCH] Don't exit-program on X11 selection-event protocol errors There are situations where transient xcb errors can be generated in regard to copy/paste selection. One example was reported in connection with "wl-clip-persist" in issue #6128. And another in issue #5482. But there's no reason for us to terminate in response, so catch and report any selection-related errors, as per code review in PR #6135 --- window/src/os/x11/window.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index 58ec4f8936f..04ee70e802c 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -795,13 +795,21 @@ impl XWindowInner { conn.child_to_parent_id.borrow_mut().remove(&self.child_id); } Event::X(xcb::x::Event::SelectionClear(e)) => { - self.selection_clear(e)?; + if let Err(err) = self.selection_clear(e) { + log::error!("Error handling SelectionClear: {err:#}"); + } } Event::X(xcb::x::Event::SelectionRequest(e)) => { - self.selection_request(e)?; + if let Err(err) = self.selection_request(e) { + // Don't propagate this, as it is not worth exiting the program over it. + // + log::error!("Error handling SelectionRequest: {err:#}"); + } } Event::X(xcb::x::Event::SelectionNotify(e)) => { - self.selection_notify(e)?; + if let Err(err) = self.selection_notify(e) { + log::error!("Error handling SelectionNotify: {err:#}"); + } } Event::X(xcb::x::Event::PropertyNotify(msg)) => { let atom_name = conn.atom_name(msg.atom());