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

get_clipboard_string() is broken #474

Open
installgentoo opened this issue Apr 15, 2021 · 1 comment
Open

get_clipboard_string() is broken #474

installgentoo opened this issue Apr 15, 2021 · 1 comment
Labels

Comments

@installgentoo
Copy link

If you call get_clipboard_string() while you clipboard is empty, on linux at least, you'll panic on

    if (!*selectionString)
    {
        _glfwInputError(GLFW_FORMAT_UNAVAILABLE,
                        "X11: Failed to convert selection to string");
    }

and one needs to provide error callback to avoid this. Meanwhile get_clipboard_string() returns Option<> so you expect it to just return None instead of panicking.

@bvssvni bvssvni added the bug label Apr 21, 2021
@aloucks
Copy link
Contributor

aloucks commented Dec 5, 2021

I agree that it's a little surprising, but this is the expected outcome if you use glfw::init(glfw::FAIL_ON_ERRORS). Perhaps you could submit a GLFW issue to treat an empty clipboard differently from conversion error.

As you mentioned, providing a custom error callback could be used to ignore GLFW_FORMAT_UNAVAILABLE. It wouldn't hurt to add some documentation to this method to describe this edge case.

vosen pushed a commit that referenced this issue Nov 5, 2024
Adding dirent.h support to unistd.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants