Permalink
Browse files

fix strong reference cycles

  • Loading branch information...
1 parent 8c50bca commit 5b2a18995c630edb1e6ceb7c24f1f248b0105ae5 @ydogs committed Dec 16, 2013
@@ -80,8 +80,9 @@ @implementation WHBlogViewController
- (void)viewDidLoad
{
[super viewDidLoad];
+ WHBlogViewController * __weak weakSelf = self;
[self.tableView addPullToRefreshWithActionHandler:^{
- [self.feed fetch];
+ [weakSelf.feed fetch];
}];
}
@@ -80,8 +80,9 @@ - (void)calculateThumbnailSizes {
- (void)viewDidLoad {
[super viewDidLoad];
+ WHPhotoGalleryViewController * __weak weakSelf = self;
[self.tableView addPullToRefreshWithActionHandler:^{
- [self.feed fetch];
+ [weakSelf.feed fetch];
}];
self.tableView.pullToRefreshView.textColor = [UIColor lightGrayColor];
@@ -81,8 +81,9 @@ - (void)viewDidLoad
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];
+ WHReaderViewController * __weak weakSelf = self;
[self.tableView addPullToRefreshWithActionHandler:^{
- [self.feed fetch];
+ [weakSelf.feed fetch];
}];
}
@@ -84,9 +84,10 @@ - (void)fetchResults
NINetworkRequestOperation *op = [[NINetworkRequestOperation alloc] initWithURL:searchURL];
// this block will be called with the operation itself
+ NINetworkRequestOperation * __weak weakOp = op;
op.didFinishBlock = ^(id obj) {
// cast it to access network-op-specific properties
- id result = [NSJSONSerialization JSONObjectWithData:op.data options:0 error:nil];
+ id result = [NSJSONSerialization JSONObjectWithData:weakOp.data options:0 error:nil];
DebugLog(@"API result = %@", result);
id results = [result objectForKey:@"results"];
if (results && [results respondsToSelector:@selector(objectAtIndex:)]) {

0 comments on commit 5b2a189

Please sign in to comment.