diff --git a/Frameworks/UIKit/UIButton.mm b/Frameworks/UIKit/UIButton.mm index dc2518ae2f..e6e493a370 100644 --- a/Frameworks/UIKit/UIButton.mm +++ b/Frameworks/UIKit/UIButton.mm @@ -173,11 +173,11 @@ - (void)_initUIButton { WXCTextBlock* templateText = rt_dynamic_cast([WXCTextBlock class], [_xamlButton getTemplateChild:@"buttonText"]); if (templateText) { - _proxyLabel = [[_UILabel_Proxy alloc] initWithXamlElement:templateText font:[UIFont buttonFont]]; + _proxyLabel.attach([[_UILabel_Proxy alloc] initWithXamlElement:templateText font:[UIFont buttonFont]]); } if (templateImage) { - _proxyImageView = [[_UIImageView_Proxy alloc] initWithXamlElement:templateImage]; + _proxyImageView.attach([[_UIImageView_Proxy alloc] initWithXamlElement:templateImage]); } _contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; @@ -971,4 +971,4 @@ - (void)setAttributedTitle:(NSAttributedString*)title forState:(UIControlState)s UNIMPLEMENTED(); } -@end \ No newline at end of file +@end diff --git a/Frameworks/UIKit/UITableView.mm b/Frameworks/UIKit/UITableView.mm index 3b89be9558..dbbe77d385 100644 --- a/Frameworks/UIKit/UITableView.mm +++ b/Frameworks/UIKit/UITableView.mm @@ -634,11 +634,11 @@ static void initInternal(UITableView* self) { priv->_defaultRowHeight = 50.0f; priv->_defaultSectionHeaderHeight = 22.0f; priv->_footerYPos = 0.f; - priv->_reusableCellNibs = [NSMutableDictionary new]; - priv->_reusableHeaderClasses = [NSMutableDictionary new]; - priv->_reusableCellClasses = [NSMutableDictionary new]; - self->_indexPathsForSelectedItems = [NSMutableSet new]; - self->_indexPathsForHighlightedItems = [NSMutableSet new]; + priv->_reusableCellNibs.attach([NSMutableDictionary new]); + priv->_reusableHeaderClasses.attach([NSMutableDictionary new]); + priv->_reusableCellClasses.attach([NSMutableDictionary new]); + self->_indexPathsForSelectedItems.attach([NSMutableSet new]); + self->_indexPathsForHighlightedItems.attach([NSMutableSet new]); priv->_separatorStyle = 0; self.showsHorizontalScrollIndicator = FALSE; } @@ -1464,7 +1464,7 @@ - (id)dequeueReusableCellWithIdentifier:(NSString*)identifier forIndexPath:(NSIn return [ret autorelease]; } - return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; + return [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease]; } /** diff --git a/Frameworks/UIKit/UITableViewCell.mm b/Frameworks/UIKit/UITableViewCell.mm index a7b5e8476c..dc45acfd67 100644 --- a/Frameworks/UIKit/UITableViewCell.mm +++ b/Frameworks/UIKit/UITableViewCell.mm @@ -349,7 +349,7 @@ - (instancetype)initWithCoder:(NSCoder*)coder { _cellBackgroundColor = [UIColor clearColor]; } - _swipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(_didSwipe:)]; + _swipeGestureRecognizer.attach([[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(_didSwipe:)]); [_swipeGestureRecognizer setDelegate:self]; [self addGestureRecognizer:_swipeGestureRecognizer]; return ret; diff --git a/Frameworks/UIKit/UIViewController.mm b/Frameworks/UIKit/UIViewController.mm index e7a3dd8135..6e2204279f 100644 --- a/Frameworks/UIKit/UIViewController.mm +++ b/Frameworks/UIKit/UIViewController.mm @@ -2422,7 +2422,7 @@ - (void)removeFromParentViewController { } } - _UILayoutGuide* tlg = [[_UILayoutGuide alloc] initWithIdentifier:@"_UIViewControllerTop"]; + _UILayoutGuide* tlg = [[[_UILayoutGuide alloc] initWithIdentifier:@"_UIViewControllerTop"] autorelease]; [view addSubview:tlg]; [view addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop @@ -2462,7 +2462,7 @@ - (void)removeFromParentViewController { } } - _UILayoutGuide* blg = [[_UILayoutGuide alloc] initWithIdentifier:@"_UIViewControllerBottom"]; + _UILayoutGuide* blg = [[[_UILayoutGuide alloc] initWithIdentifier:@"_UIViewControllerBottom"] autorelease]; [view addSubview:blg]; [view addConstraint:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom diff --git a/Frameworks/UIKit/UIWebView.mm b/Frameworks/UIKit/UIWebView.mm index 90c0f2cab4..4f0a32acde 100644 --- a/Frameworks/UIKit/UIWebView.mm +++ b/Frameworks/UIKit/UIWebView.mm @@ -37,7 +37,7 @@ @implementation UIWebView { id _delegate; idretaintype(NSURLRequest) _request; bool _isLoading; - UIScrollView* _scrollView; + StrongId _scrollView; StrongId _xamlWebControl; EventRegistrationToken _xamlLoadCompletedEventCookie; EventRegistrationToken _xamlLoadStartedEventCookie; @@ -168,7 +168,7 @@ static void _initUIWebView(UIWebView* self) { bounds = [self bounds]; // For compatibility only - self->_scrollView = [[UIScrollView alloc] initWithFrame:bounds]; + self->_scrollView.attach([[UIScrollView alloc] initWithFrame:bounds]); [self setNeedsLayout]; } diff --git a/Frameworks/UIKit/UrlLauncher.mm b/Frameworks/UIKit/UrlLauncher.mm index 87672a52eb..d39ca2ebd0 100644 --- a/Frameworks/UIKit/UrlLauncher.mm +++ b/Frameworks/UIKit/UrlLauncher.mm @@ -15,16 +15,17 @@ //****************************************************************************** #import "UrlLauncher.h" +#import "Starboard.h" #import "NSLogging.h" static const wchar_t* TAG = L"UrlLauncher"; @interface UrlLauncher () { Class _launcher; - NSCondition* _launchCondition; + StrongId _launchCondition; BOOL _launchCompleted; BOOL _launchDidSucceed; - NSCondition* _canOpenCondition; + StrongId _canOpenCondition; BOOL _canOpenCompleted; BOOL _canOpenDidSucceed; } @@ -34,8 +35,8 @@ @implementation UrlLauncher - (UrlLauncher*)initWithLauncher:(Class)launcher { if (self = [super init]) { _launcher = launcher; - _launchCondition = [NSCondition new]; - _canOpenCondition = [NSCondition new]; + _launchCondition.attach([NSCondition new]); + _canOpenCondition.attach([NSCondition new]); } return self;