rust-windowing / rust-windowing/winit
Panic: called `Option::unwrap()` on a `None` value
Open
Nobody has claimed this yet.
B - bug
DS - win32
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
Description
Winit: 0.30.13
winit::platform_impl::windows:⌨️:impl$1::process_message::closure$0 (keyboard.rs:161)
Our user reported a crash that seems to hit:
WM_DEADCHAR | WM_SYSDEADCHAR => {
let pending_token = self.pending.add_pending();
*result = ProcResult::Value(0);
// At this point, we know that there isn't going to be any more events related
// to this key press
let event_info = self.event_info.lock().unwrap().take().unwrap(); // THIS
let ev = event_info.finalize();
MatchResult::MessagesToDispatch(self.pending.complete_pending(
pending_token,
MessageAsKeyEvent { event: ev, is_synthetic: false },
))
},
I'm not sure what to do about it, but the lib should not crash on a key press.
Windows version
windows 10.0.19045
Winit version
0.30.13
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 at the WM_DEADCHAR/WM_SYSDEADCHAR branch in keyboard.rs:161 and trace how event_info is populated before the unwrap. Reproduce or investigate the Windows 10 key-press path, then verify that the reported case no longer panics when event_info is absent and add coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100