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

Safe menu initialization for the Windows platform #273

Open
parasyte opened this issue Feb 5, 2025 · 0 comments
Open

Safe menu initialization for the Windows platform #273

parasyte opened this issue Feb 5, 2025 · 0 comments

Comments

@parasyte
Copy link

parasyte commented Feb 5, 2025

#227 made Menu::init_for_hwnd() and friends unsafe. While this is a good idea for methods with this type signature, the change harms usability.

My proposal is making safe alternatives to these methods via the raw-window-handle crate. These methods can accept a reference that implements the HasWindowHandle trait. This proposed design avoids the requirement for callers to uphold the invariant that the hWnd must be valid; that is ensured by the trait implementer. In other words, unsafety will be properly encapsulated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant