Compare commits
2 Commits
4a80165428
...
9cc65e70ea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cc65e70ea | ||
|
|
750eae7a93 |
@@ -383,6 +383,36 @@ pub( crate ) fn try_run<A: App>( app: A ) -> Result<(), RunError>
|
||||
data.exit_requested = true;
|
||||
continue;
|
||||
}
|
||||
Err( calloop::Error::OtherError( ref e ) ) =>
|
||||
{
|
||||
// wayland-client surfaces the closed-socket condition as an
|
||||
// OtherError wrapping a WaylandError::Io(BrokenPipe) — one
|
||||
// level deeper than a direct io::Error. Walk the source()
|
||||
// chain so we catch it regardless of how many wrapper types
|
||||
// sit between calloop and the raw io::Error.
|
||||
let mut src: Option<&dyn std::error::Error> = Some( e.as_ref() );
|
||||
let mut is_closed = false;
|
||||
while let Some( err ) = src
|
||||
{
|
||||
if let Some( io ) = err.downcast_ref::<std::io::Error>()
|
||||
{
|
||||
if matches!( io.kind(),
|
||||
std::io::ErrorKind::BrokenPipe | std::io::ErrorKind::ConnectionReset )
|
||||
{
|
||||
is_closed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
src = err.source();
|
||||
}
|
||||
if is_closed
|
||||
{
|
||||
eprintln!( "ltk: wayland connection lost; exiting" );
|
||||
data.exit_requested = true;
|
||||
continue;
|
||||
}
|
||||
panic!( "dispatch: {e:?}" );
|
||||
}
|
||||
Err( e ) => panic!( "dispatch: {e:?}" ),
|
||||
}
|
||||
// Any surface whose press has now crossed `long_press_duration`
|
||||
|
||||
Reference in New Issue
Block a user