Skip to content

Commit

Permalink
Fix double close when calling xkb::Keymap::new_from_fd
Browse files Browse the repository at this point in the history
`strace ./target/debug/examples/simple_window 2>&1| grep EBADF` shows
this error before this change.

`new_from_fd` calls `File::from` on the fd, which results in closing it
on drop.
  • Loading branch information
ids1024 committed Sep 30, 2023
1 parent 4ac6853 commit 15ae2c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/seat/keyboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
fmt::Debug,
marker::PhantomData,
num::NonZeroU32,
os::unix::io::AsRawFd,
os::unix::io::IntoRawFd,
sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
Expand Down Expand Up @@ -534,7 +534,7 @@ where
match unsafe {
xkb::Keymap::new_from_fd(
&context,
fd.as_raw_fd(),
fd.into_raw_fd(),
size as usize,
xkb::KEYMAP_FORMAT_TEXT_V1,
xkb::COMPILE_NO_FLAGS,
Expand Down

0 comments on commit 15ae2c2

Please sign in to comment.