Fix crash when failing to write to a clipboard (#29)

Fix crash when failing to write to a clipboard
This commit is contained in:
Kirill Chibisov 2020-10-13 16:25:36 +03:00 committed by GitHub
parent 05b6dec99c
commit da2637af29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -2,6 +2,8 @@
## Unreleased
- Crash when failing to write to a clipboard
## 0.6.0 -- 2020-10-03
- Updated smithay-client-toolkit to 0.12

View file

@ -76,7 +76,9 @@ macro_rules! handle_store {
vec![MimeType::TextPlainUtf8.to_string(), MimeType::Utf8String.to_string()],
move |event, _| {
if let $event_ty::Send { mut pipe, .. } = event {
write!(pipe, "{}", $contents).unwrap();
// If we fail to write here, it means that other side closed the pipe, thus
// we can't do anything about it.
let _ = write!(pipe, "{}", $contents);
}
},
);