Permalink
Browse files

Fixed memory leak

Fix memory leak of selectedTile and highlightedTile instances caused by
their improper setter implementation (the setter should release the old
value before assigning and retaining the new value) Origin: ehren
  • Loading branch information...
1 parent 974e593 commit 1ee83c2a4316417cac2f717c285832ccbb811f2f @ChrisRM ChrisRM committed Apr 16, 2012
View
@@ -112,6 +112,7 @@ - (void)setHighlightedTile:(KalTileView *)tile
{
if (highlightedTile != tile) {
highlightedTile.highlighted = NO;
+ [highlightedTile release];
highlightedTile = [tile retain];
tile.highlighted = YES;
[tile setNeedsDisplay];
@@ -122,6 +123,7 @@ - (void)setSelectedTile:(KalTileView *)tile
{
if (selectedTile != tile) {
selectedTile.selected = NO;
+ [selectedTile release];
selectedTile = [tile retain];
tile.selected = YES;
[delegate didSelectDate:tile.date];

0 comments on commit 1ee83c2

Please sign in to comment.