Skip to content

Improve error handling and resource cleanup in linux/x11/window.rs#21079

Merged
mgsloan merged 1 commit into
mainfrom
improve-x11-error-handling-in-window-rs
Nov 22, 2024
Merged

Improve error handling and resource cleanup in linux/x11/window.rs#21079
mgsloan merged 1 commit into
mainfrom
improve-x11-error-handling-in-window-rs

Conversation

@mgsloan

@mgsloan mgsloan commented Nov 22, 2024

Copy link
Copy Markdown
Contributor
  • Fixes registration of event handler for xinput-2 device changes, revealed by this improvement.

  • Pushes .unwrap() panic-ing outwards to callers.

  • Includes a description of what the X11 call was doing when a failure was encountered.

  • Fixes a variety of places where the X11 reply wasn't being inspected for failures.

  • Destroys windows on failure during setup. New structure makes it possible for the caller of open_window to carry on despite failures, and so partially initialized window should be removed (though all calls I looked at also panic currently).

Considered pushing this through linux/x11/client.rs too but figured it'd be nice to minimize merge conflicts with #20853.

Release Notes:

  • N/A

@mgsloan mgsloan force-pushed the improve-x11-error-handling-in-window-rs branch 2 times, most recently from 8381c5c to 0a7495d Compare November 22, 2024 21:43
* Fixes registration of event handler for xinput-2 device changes,
revealed by this improvement.

* Pushes `.unwrap()` panic-ing outwards to callers.

* Includes a description of what the X11 call was doing when a failure
was encountered.

* Fixes a variety of places where the X11 reply wasn't being inspected
for failures.

* Destroys windows on failure during setup. New structure makes it
possible for the caller of `open_window` to carry on despite failures,
and so partially initialized window should be removed (though all
calls I looked at also panic currently).

Considered pushing this through `linux/x11/client.rs` too but figured it'd be nice to minimize merge conflicts with #20853.
@mgsloan mgsloan force-pushed the improve-x11-error-handling-in-window-rs branch from 0a7495d to ed01141 Compare November 22, 2024 22:41
@mgsloan mgsloan merged commit c9f2c27 into main Nov 22, 2024
@mgsloan mgsloan deleted the improve-x11-error-handling-in-window-rs branch November 22, 2024 23:03
@notpeter notpeter added the cla-signed The user has signed the Contributor License Agreement label Nov 23, 2024
mgsloan added a commit that referenced this pull request Jun 18, 2025
Continuing this work from a while back in #21079, now greatly aided by agent + sonnet 4
mgsloan added a commit that referenced this pull request Jun 18, 2025
Now there are only a few spots that explicitly panic, though errors during initialization will panic.

Continuing this work from a while back in #21079, now greatly aided by agent + sonnet 4
mgsloan added a commit that referenced this pull request Jun 18, 2025
Now there are only a few spots that explicitly panic, though errors during initialization will panic.

Continuing this work from a while back in #21079, now greatly aided by agent + sonnet 4
mgsloan added a commit that referenced this pull request Jun 18, 2025
Now there are only a few spots that explicitly panic, though errors during initialization will panic.

Continuing this work from a while back in #21079, now greatly aided by agent + sonnet 4
mgsloan added a commit that referenced this pull request Jun 18, 2025
Now there are only a few spots that explicitly panic, though errors during initialization will panic.

Continuing this work from a while back in #21079, now greatly aided by agent + sonnet 4
mgsloan added a commit that referenced this pull request Jun 18, 2025
Continuing this work from a while back in #21079, now greatly aided by
agent + sonnet 4. With this change, there are now only a few spots that
explicitly panic, though errors during initialization will panic.

Motivation was this recent user panic in `handle_event`, figured fixing
all this use of unwrap was a great use of the agent.

> called `Result::unwrap()` on an `Err` value: X11 GetProperty for
_NET_WM_STATE failed.

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants