Skip to content

Don't use auto-release pool in string-related methods #218

Open

Description

@kvark

We have set_label methods, which use nsstring_from_str, which uses auto-release pool. This is inviting for leaks in user code. There is no reason why set_label should use any auto-release pools, technically.

Proposal - split nsstring_as_str into separate methods for creation of an NSString and borrowing it as str. This way, the calling code is responsible for freeing it when needed. don't autorelease NSString. Instead, return an object that the caller can free explicitly by dropping. The caller is our own method in this case, so we can ensure the lifetime is correct.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions