Skip to content

Commit

Permalink
Don't exit-program on X11 selection-event protocol errors
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
loops authored and wez committed Sep 14, 2024
1 parent 5212cd4 commit 9668fa9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions window/src/os/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
// <https://github.com/wez/wezterm/pull/6135>
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());
Expand Down

0 comments on commit 9668fa9

Please sign in to comment.