Skip to content

Add method to hook xlib error handler#2385

Merged
kchibisov merged 1 commit intorust-windowing:masterfrom
kchibisov:xlib-error-handling
Jul 22, 2022
Merged

Add method to hook xlib error handler#2385
kchibisov merged 1 commit intorust-windowing:masterfrom
kchibisov:xlib-error-handling

Conversation

@kchibisov
Copy link
Copy Markdown
Member

This should help glutin to handle errors coming from GLX
and provide multithreading access in a safe way.

Fixes #2378.

@kchibisov kchibisov requested a review from maroider July 20, 2022 20:05
@kchibisov kchibisov force-pushed the xlib-error-handling branch from 4670213 to 461a5c4 Compare July 20, 2022 20:06
@kchibisov kchibisov force-pushed the xlib-error-handling branch from 461a5c4 to 7503fee Compare July 21, 2022 19:50
@kchibisov kchibisov requested a review from maroider July 21, 2022 19:51
@kchibisov kchibisov force-pushed the xlib-error-handling branch from 7503fee to 7b98a70 Compare July 21, 2022 20:57
@notgull
Copy link
Copy Markdown
Contributor

notgull commented Jul 22, 2022

I'd rather it be a Box<dyn Fn()> rather than an fn(), so that closures can be attached to the functions.

@kchibisov
Copy link
Copy Markdown
Member Author

I thought about, but I'm not sure. Given that it must be send + sync.

@maroider
Copy link
Copy Markdown
Member

maroider commented Jul 22, 2022

If we want closures, then I don't think there's necessarily anything wrong with requiring said closures to be Send + Sync when the alternative is to use global mutable state. Either way (Fn trait objects or function pointers) is fine by me.

This should help glutin to handle errors coming from GLX
and provide multithreading access in a safe way.

Fixes rust-windowing#2378.
@kchibisov kchibisov force-pushed the xlib-error-handling branch from 7b98a70 to 18d3fa9 Compare July 22, 2022 16:50
@kchibisov
Copy link
Copy Markdown
Member Author

I've updated to use closures instead.

@kchibisov kchibisov merged commit 1ec976f into rust-windowing:master Jul 22, 2022
@kchibisov kchibisov deleted the xlib-error-handling branch July 22, 2022 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Publicly expose last error received from X11

3 participants