New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fabric: fix border memory leaks #23815
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is 100% valid concern ❤️!
... but probably not the best solution.
I think we should rename the method (or create an additional one) to RCTCGColorRefUnretainedFromSharedColor
, annotate it with CF_RETURNS_NOT_RETAINED
and don't use Create
inside.
RCTBorderColors
@shergin I think I addressed your feedback. |
@@ -396,7 +398,9 @@ - (void)invalidateLayer | |||
} | |||
|
|||
layer.borderWidth = (CGFloat)borderMetrics.borderWidths.left; | |||
layer.borderColor = RCTCGColorRefFromSharedColor(borderMetrics.borderColors.left); | |||
CGColorRef borderColor = RCTCGColorRefFromSharedColor(borderMetrics.borderColors.left) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that this part is correct (or optimal), but I trust you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI says that it does not compile and needs linting. :)
@shergin maybe this fixes the complaints? :) |
semicolon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @ericlewis in 8e490d4. When will my fix make it into a release? | Upcoming Releases |
Summary
This fixes a few memory leaks in fabrics handling of colors for borders, when using CGColorRef's we must be diligent about releasing the memory back.
Changelog
[iOS] [Fixed] - Border style memory leaks
Test Plan
Run RNTester, and ensure it is working, notice no memory leaks from CoreGraphics.