Skip to content
Browse files

Fixed a retain-cycle in the cell

  • Loading branch information...
1 parent c1b221f commit cc2df638e82b6bea910fc5d7542e7c62cff92f9c @gmoledina committed Nov 23, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 GMGridView/API/GMGridView.m
View
8 GMGridView/API/GMGridView.m
@@ -997,13 +997,15 @@ - (GMGridViewCell *)newItemSubViewForPosition:(NSInteger)position
cell.tag = position + kTagOffset;
cell.editing = self.editing;
+ __weak GMGridView *weakSelf = self;
+
cell.deleteBlock = ^(GMGridViewCell *cell)
{
- NSInteger index = [self positionForItemSubview:cell];
+ NSInteger index = [weakSelf positionForItemSubview:cell];
if (index != GMGV_INVALID_POSITION)
{
- [self.dataSource GMGridView:self deleteItemAtIndex:index];
- [self removeObjectAtIndex:index];
+ [weakSelf.dataSource GMGridView:self deleteItemAtIndex:index];
+ [weakSelf removeObjectAtIndex:index];
}
};

0 comments on commit cc2df63

Please sign in to comment.
Something went wrong with that request. Please try again.