Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure X11 connections are closed #3924

Merged
merged 1 commit into from
Jul 13, 2023
Merged

Ensure X11 connections are closed #3924

merged 1 commit into from
Jul 13, 2023

Conversation

wez
Copy link
Contributor

@wez wez commented Jul 12, 2023

Checklist

  • Run cargo clippy.
  • Run cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
#3813

Description
Introduces a DisplayOwner struct to own both the library and associated display pointer; their lifetimes are combined in that struct.

The display pointer is encapsulated in a DisplayRef.

When DisplayOwner is dropped, it ensures that the DisplayRef is correctly closed prior to unloading the library.

This PR looks bigger than it really is because of rustfmt'd whitespace changes in the main part of the code.

Testing
As explained in #3813, the hello example is modified to create multiple Instances, and then pause before shutting down the program.

Then in another window: lsof -p $(pgrep hello) | grep STREAM | wc -l is used to count the number of open descriptors. Prior to this change the count correlated with the number of Instances created by the program. With this change there are 0.

Note: the state of trunk at the moment has a unexpectedly passing test; that is not due to this change:

--- STDERR:              wgpu-test::wgpu-tests shader::struct_layout::uniform_input ---
thread 'shader::struct_layout::uniform_input' panicked at 'UNEXPECTED TEST PASS: FailureReasons(BACKEND)', /home/wez/wez-personal/github/wgpu/tests/src/lib.rs:330:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Introduces a DisplayOwner struct to own both the library
and associated display pointer; their lifetimes are combined
in that struct.

The display pointer is encapsulated in a DisplayRef.

When DisplayOwner is dropped, it ensures that the DisplayRef
is correctly closed prior to unloading the library.

refs: gfx-rs#3813
@nical nical merged commit 2af6d1b into gfx-rs:trunk Jul 13, 2023
20 checks passed
wez added a commit to wez/wezterm that referenced this pull request Jul 22, 2023
Pick up my fix from gfx-rs/wgpu#3924

closes: #3612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants