Skip to content

Release methods need semantic understanding #25

Closed

Description

In order to invoke the release methods properly, we need to understand whether they were successful. But they're all over the map on this. For example:

These is just a sampling. For each method, we need to know what constitutes success.

Activity

  1. AArnott commented on Nov 14, 2020

    @AArnott
    MemberAuthor

    One really weird outlier is ClosePrivateNamespace which takes two parameters. I think we'll just have to avoid generating a SafeHandle for that one.

  2. added
    usability
    on Jan 14, 2021
  3. Robo210 commented on Mar 11, 2021

    @Robo210
    Contributor

    I believe the release methods will also need to understand what constitutes a "invalid" or sentinel value as well. Some APIs use NULL while others use INVALID_HANDLE_VALUE, and the two aren't always equivalent (but sometimes they are). If a safe handle needs to condition the close on whether the handle value is valid, it will need to know what an invalid handle looks like.

    WIL's unique_any is a good example of all the data that's actually required to build a safe handle around the numerous Win32 handle types.

  4. AArnott commented on Mar 17, 2021

    @AArnott
    MemberAuthor

    ReleaseDC is another odd case that takes two parameters.

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

    usability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions