Fix panic when wayland display connection breaks
Instead, terminate the thread and consider the clipboard dead. The application can now gracefully deal with the situation. Closes: #52
This commit is contained in:
parent
858419b586
commit
ee63d81a57
3 changed files with 5 additions and 9 deletions
|
|
@ -42,9 +42,9 @@ impl MimeType {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToString for MimeType {
|
||||
fn to_string(&self) -> String {
|
||||
String::from(ALLOWED_MIME_TYPES[*self as usize])
|
||||
impl std::fmt::Display for MimeType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", ALLOWED_MIME_TYPES[*self as usize])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,9 +95,7 @@ fn worker_impl(
|
|||
WaylandSource::new(connection, event_queue).insert(loop_handle).unwrap();
|
||||
|
||||
loop {
|
||||
event_loop.dispatch(None, &mut state).unwrap();
|
||||
|
||||
if state.exit {
|
||||
if event_loop.dispatch(None, &mut state).is_err() || state.exit {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue