Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11: Add timeout for getting clipboard contents #1866

Merged
merged 2 commits into from
Jul 10, 2021

Commits on Jul 9, 2021

  1. X11: Add timeout for getting clipboard contents

    When the selection does not answer, the code would just hang while
    waiting for a reply. This could e.g. happen when the "other end"
    crashes.
    
    Handle this situation by applying a timeout of five seconds for getting
    the clipboard contents. After this timeout, the transfer is aborted with
    an error.
    
    This was tested by batching handle_request() in druid-shell's clipboard
    code to just return Ok(()). Then, I started the following program:
    
        fn main() { druid_shell::Application::new().unwrap().clipboard().put_string("whatever"); }
    
    Afterwards, trying to get the clipboard contents with druid_shell would
    just hang.
    
    With this commit, the following happens instead:
    
         WARN druid_shell::backend::x11::clipboard: Error in Clipboard::do_transfer: ConnectionError(IOError(Custom { kind: TimedOut, error: "Timeout while waiting for selection owner to reply" }))
    
    Signed-off-by: Uli Schlachter <psychon@znc.in>
    psychon committed Jul 9, 2021
    Configuration menu
    Copy the full SHA
    b54f64d View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2021

  1. Configuration menu
    Copy the full SHA
    e99a8c7 View commit details
    Browse the repository at this point in the history