fix(wayland): graceful exit on compositor disconnect
Replace 3 panicking unwrap() in cosmic-app-list/wayland_handler.rs (event loop dispatch + 2 conn.flush in screencopy) with logged errors that break/return None instead. Wrap cosmic-applets/main.rs entry point in panic::catch_unwind to catch panics propagating from libcosmic/iced/winit (which we cannot patch locally without forking) when the COSMIC compositor closes the Wayland connection at logout. This eliminates the cascade of ~12 SIGABRT coredumps observed at session shutdown. Panic strategy is unwind (default), catch_unwind is sound here. Leyoda 2026 – GPLv3
This commit is contained in:
parent
0fa93ba21f
commit
6fe087f4fd
2 changed files with 48 additions and 21 deletions
|
|
@ -388,7 +388,10 @@ impl CaptureData {
|
|||
},
|
||||
)
|
||||
.unwrap();
|
||||
self.conn.flush().unwrap();
|
||||
if let Err(err) = self.conn.flush() {
|
||||
tracing::error!("Wayland flush failed during screencopy session create: {err}");
|
||||
return None;
|
||||
}
|
||||
|
||||
let formats = session
|
||||
.wait_while(|data| data.formats.is_none())
|
||||
|
|
@ -437,7 +440,10 @@ impl CaptureData {
|
|||
session: capture_session.clone(),
|
||||
},
|
||||
);
|
||||
self.conn.flush().unwrap();
|
||||
if let Err(err) = self.conn.flush() {
|
||||
tracing::error!("Wayland flush failed during screencopy capture: {err}");
|
||||
return None;
|
||||
}
|
||||
|
||||
// TODO: wait for server to release buffer?
|
||||
let res = session
|
||||
|
|
@ -709,7 +715,10 @@ pub(crate) fn wayland_handler(
|
|||
if app_data.exit {
|
||||
break;
|
||||
}
|
||||
event_loop.dispatch(None, &mut app_data).unwrap();
|
||||
if let Err(err) = event_loop.dispatch(None, &mut app_data) {
|
||||
tracing::error!("Wayland event loop terminated: {err}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue