Skip to content

Commit

Permalink
Fix leak of some associated properties in AutoLayout.mm (microsoft#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehren committed Nov 30, 2016
1 parent d6025e1 commit 9a537f0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Frameworks/AutoLayout/AutoLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ - (_NSLayoutConstraintStorage*)_constraintStorage {
}

- (void)autoLayoutAlloc {
objc_setAssociatedObject(self, @selector(_constraintStorage), [_NSLayoutConstraintStorage new], OBJC_ASSOCIATION_RETAIN);
_NSLayoutConstraintStorage* storage = [_NSLayoutConstraintStorage new];
objc_setAssociatedObject(self, @selector(_constraintStorage), storage, OBJC_ASSOCIATION_RETAIN);
[storage release];
}

- (void)autoLayoutConstraintAddedToView:(UIView*)view {
Expand Down Expand Up @@ -312,7 +314,9 @@ - (void)_removeFromSolver {
@implementation UILayoutGuide (AutoLayout)

- (void)autoLayoutAlloc {
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), [_AutoLayoutStorage new], OBJC_ASSOCIATION_RETAIN);
_AutoLayoutStorage* storage = [_AutoLayoutStorage new];
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), storage, OBJC_ASSOCIATION_RETAIN);
[storage release];
}

- (CGRect)autoLayoutGetRect {
Expand Down Expand Up @@ -355,7 +359,9 @@ - (AutoLayoutProperties*)_autoLayoutProperties {
}

- (void)autoLayoutAlloc {
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), [_AutoLayoutStorage new], OBJC_ASSOCIATION_RETAIN);
_AutoLayoutStorage* storage = [_AutoLayoutStorage new];
objc_setAssociatedObject(self, @selector(_autoLayoutProperties), storage, OBJC_ASSOCIATION_RETAIN);
[storage release];
}

- (void)autoLayoutSetFrameToView:(UIView*)toView fromView:(UIView*)fromView {
Expand Down

0 comments on commit 9a537f0

Please sign in to comment.