Skip to content

Commit

Permalink
Remove calls to CGColorRelease in box shadow impl (#45488)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #45488

In certain cases where the color fails to parse, this code will throw an exception since the underlying color does not exist and we are trying to free it. We do not actually need to even do this, since we obtain the CGColor from a UIColor. The UIColor will manage the memory of the CGColor in this case so we are fine.

Source: https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-SW1

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D59819536

fbshipit-source-id: ace4656475e7deecac215acb67cb419141e432ea
  • Loading branch information
joevilches authored and facebook-github-bot committed Jul 18, 2024
1 parent 1e20e49 commit 66465fb
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ static void renderOutsetShadows(
CGContextFillPath(context);

CGPathRelease(shadowRectPath);
CGColorRelease(color);
CGContextRestoreGState(context);
}
// Lastly, clear out the region inside the view so that the shadows do
Expand Down Expand Up @@ -255,7 +254,6 @@ static void renderInsetShadows(
CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);
CGContextEOFillPath(context);

CGColorRelease(color);
CGContextRestoreGState(context);
}

Expand Down

0 comments on commit 66465fb

Please sign in to comment.