-
Notifications
You must be signed in to change notification settings - Fork 806
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
Fixing more UIKit memory leaks #1861
Conversation
@@ -184,7 +184,7 @@ - (void)_initUIButton { | |||
_contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; | |||
_contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; | |||
|
|||
__block UIButton* weakSelf = self; | |||
__weak UIButton* weakSelf = self; |
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.
UIButton [](start = 11, length = 8)
unrelated: in UIView.mm, line 758, is it also another misusage?
// Subscribe to the XAML node's input events
__block UIView* weakSelf = self; #Resolved
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.
No. UIView doesn't have ARC enabled, so you can't use __weak.
In reply to: 98295161 [](ancestors = 98295161)
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.
interesting, block will +1 for reference count in arc but not for non-arc case.
In reply to: 98295339 [](ancestors = 98295339,98295161)
@@ -36,6 +36,72 @@ | |||
ASSERT_TRUE([backingElement isKindOfClass:[WXFrameworkElement class]]); | |||
} | |||
|
|||
@interface UIDeallocTestButton : UIButton { | |||
NSCondition* _condition; | |||
BOOL* _signaled; |
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.
BOOL* [](start = 4, length = 5)
Why BOOL* and not just BOOL. #Resolved
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.
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.
[_condition lock]; | ||
*_signaled = YES; | ||
[_condition signal]; | ||
[_condition unlock]; |
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 merged UXEvent into develop - should be able to leverage it now. #Resolved
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.
|
||
TEST(UIButton, CheckForLeaks) { | ||
Microsoft::WRL::WeakRef weakXamlElement; | ||
{ |
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.
{ [](start = 4, length = 1)
Does scoping it like this mean all objects are freed at the end or could we still have some autoreleasepools that need to release objects? Just asking because that was one of the concerns with fixing #1757. #Resolved
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.
Yes, that was the plan. the VC goes out of scope, etc. we could add our own autoreleasepool but the test was passing without it.
In reply to: 98299778 [](ancestors = 98299778)
__block NSCondition* condition = [[NSCondition alloc] init]; | ||
|
||
// Create and render the button | ||
dispatch_sync(dispatch_get_main_queue(), ^{ |
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.
async? #Resolved
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.
Fixing a leak in the Create* path for our UIKit.Xaml controls, and a leak in UIButton's use of 'weakSelf'.
Fixes #1858.
Fixes #1859 .