Skip to content

Safe menu initialization for the Windows platform #273

Description

@parasyte

#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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions