Update SVGEngine.mm#237
Update SVGEngine.mm#237markm68k wants to merge 1 commit intopocketsvg:masterfrom markm68k:mark-miller0-patch-3
Conversation
• 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.
|
Addresses open issue #231 |
|
thanks for your patience! this has now been fixed via 1f5b96a |
|
@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. |
|
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. |
|
Of course, that makes sense. Thanks for the explanation, @arielelkin. |
• 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.mdfile to explain your changes and credit yourself. Add the entry in the appropriate section (New Features / Fixes / Internal Change / Breaking Change) underUnreleased. Add links to your GitHub profile and to the related PR and issue after your description. Be part of history.