Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepo committed May 12, 2016
1 parent e346665 commit 66b071f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions MLeaksFinder/NSObject+MemoryLeak.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ - (BOOL)willDealloc {
if ([[NSObject classNamesInWhiteList] containsObject:className])
return NO;

id sender = objc_getAssociatedObject([UIApplication sharedApplication], kLatestSenderKey);
if (sender == self)
NSNumber *senderPtr = objc_getAssociatedObject([UIApplication sharedApplication], kLatestSenderKey);
if ([senderPtr isEqualToNumber:@((uintptr_t)self)])
return NO;

__weak id weakSelf = self;
Expand Down
2 changes: 1 addition & 1 deletion MLeaksFinder/UIApplication+MemoryLeak.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ + (void)load {
}

- (BOOL)swizzled_sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event {
objc_setAssociatedObject(self, kLatestSenderKey, sender, OBJC_ASSOCIATION_ASSIGN);
objc_setAssociatedObject(self, kLatestSenderKey, @((uintptr_t)sender), OBJC_ASSOCIATION_RETAIN);

return [self swizzled_sendAction:action to:target from:sender forEvent:event];
}
Expand Down

0 comments on commit 66b071f

Please sign in to comment.