Skip to content

Conversation

@markm68k
Copy link

• pathDefinitionParser(svgString).parse() returns a CGMutablePathRef (which is a Core Foundation object). • The method parse() (see its implementation) creates this object by calling CGPathCreateMutable(), which returns a retained object according to Core Foundation memory management rules.

Thank you for submitting a PR for PocketSVG 😀

  • If you're fixing an issue, please briefly describe the current behaviour and the new behaviour. If you're addressing an open issue, please link to it.

  • If you're introducing a new feature, please briefly describe the new behavior and provide code + sample SVGs for us to see it in action.

Please also add that as an entry in our CHANGELOG.md file to explain your changes and credit yourself. Add the entry in the appropriate section (New Features / Fixes / Internal Change / Breaking Change) under Unreleased. Add links to your GitHub profile and to the related PR and issue after your description. Be part of history.

• pathDefinitionParser(svgString).parse() returns a CGMutablePathRef (which is a Core Foundation object).
• The method parse() (see its implementation) creates this object by calling CGPathCreateMutable(), which returns a retained object according to Core Foundation memory management rules.
@markm68k
Copy link
Author

Addresses open issue #231

@arielelkin
Copy link
Collaborator

@codex

@markm68k markm68k closed this by deleting the head repository Nov 10, 2025
@arielelkin
Copy link
Collaborator

thanks for your patience! this has now been fixed via 1f5b96a

@markm68k
Copy link
Author

@arielelkin I'm curious why you chose to use CF_RETURNS_RETAINED over renaming the function to CGPathCreateFromSVGPathString which would conform to Core Foundation memory management naming conventions.

@arielelkin
Copy link
Collaborator

good question @markm68k

a rename would introduce a source/ABI break for any consumer that already links against that symbol, and i ruled out pushing out a major version bump as i had just released 3.0.0.

adding the CF_RETURNS_RETAINED attribute conveys the same ownership conventions to Clang/ARC/Swift, so existing call sites keep compiling, and the compiler+analyzer still know the caller owns the returned CGPathRef.

@markm68k
Copy link
Author

Of course, that makes sense. Thanks for the explanation, @arielelkin.

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

Successfully merging this pull request may close these issues.

2 participants