Created
November 22, 2011 11:26
-
-
Save anonymous/1385458 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the indexpath of next song. This is an autorelease object. | |
NSIndexPath *nextSongIndexPath = [NSIndexPath indexPathForRow:nextSongRow inSection:self.indexPath.section]; | |
// Get the next song using fetched results controller and nextSongIndexPath. | |
self.song = [fetchedresultsController objectAtIndexPath:nextSongIndexPath]; | |
// update the indexpath. nextSongIndexPath is an autorelease object as stated above. Since in property of indexPath its assign and not retain, the indexPath is not retaining this autorelease object (nextSongIndexPath) Hence when nextSongIndexPath gets auto-released, your indexPath will have nothing. | |
self.indexPath = nextSongIndexPath; | |
nextSongIndexPath is an autorelease object. It will get released and you will not come to know. By doing self.indexPath = nextSongIndexPath; we are saying that indexpath now points to an object (autorelease object) which is pointed by nextSongIndexPath. | |
But nextSongIndexPath points to an autorelease object. Hence indexPath also points to an auto-release object. | |
Thus when it gets auto-released, you have nothing in indexPath. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment