rust-windowing / rust-windowing/winit
`WindowHandle` is not sound
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Currently, the rwh::WindowHandle we return gets a lifetime to Window. Unfortunately this doesn't really work out because the actual lifetime of the Window isn't connected to it's semantic lifetime. If the EventLoop is exited, all Windows become invalid, therefor making all connected WindowHandles unsound to continue to use.
One simple solution that was proposed in IRC by Ralith is to extend the lifetime of all Windows even after the EventLoop was exited. This might be a viable solution as recreating the EventLoop isn't allowed anyway (except on Web).
For a more "proper" solution, we would have to introduce a lifetime to Window that is connected to the EventLoop. This would require a major API re-design.
Also discussed in:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the WindowHandle and Window lifetime discussion in this issue, then review the linked raw-window-handle and winit issues. The work is complete when the API no longer permits WindowHandle values to be used after the EventLoop has exited, with the chosen lifetime or validity model agreed and reflected in the API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100