Wayland support by catilac · Pull Request #3 · processing/libprocessing
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just minor comment on use of unsafe.
| let (raw_window_handle, raw_display_handle) = { | ||
| use raw_window_handle::{WaylandDisplayHandle, WaylandWindowHandle}; | ||
|
|
||
| let window_handle_ptr = unsafe { NonNull::new_unchecked(window_handle as *mut c_void) }; |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should only use the unchecked variants in situations where we control the provenance of the pointer, or at the least document the invariant in the safety information for this function. Here, I think we can do the lazy thing that I do above which is NonNull::new(ptr).unwrap()) which guarantees we'll at least panic if the caller passes us a null ptr (we probably should be returning HandleError).
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! Just addressed the feedback. I am returning HandleError now