From bbe409f5e34b5269ecbb7f61dbb8a793e2871d20 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Mon, 5 Sep 2011 13:03:27 -0400 Subject: Made general memory fixes This revision should also hopefully fix the undefined behavior GameOverScene bug--if it, I'll reopen the ticket and continue investigating. Fixes #215 --- Classes/HighscoreListController.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Classes/HighscoreListController.m') diff --git a/Classes/HighscoreListController.m b/Classes/HighscoreListController.m index 7dbefa1..7370da5 100755 --- a/Classes/HighscoreListController.m +++ b/Classes/HighscoreListController.m @@ -22,7 +22,7 @@ // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. self = [super initWithStyle:style]; if (self) { - localHighscores = [Highscore localHighscoreListForGameMode:@"Collect"]; + localHighscores = [[Highscore localHighscoreListForGameMode:@"Collect"] retain]; navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; myNavigationItem = [[UINavigationItem alloc] initWithTitle:@"Highscores"]; @@ -48,6 +48,7 @@ toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 480-44, 320, 44)]; [toolbar setItems:[NSArray arrayWithObjects:barButton3, btnSpace, barButton2, nil] animated:NO]; [barButton2 release]; + [btnSpace release]; [barButton3 release]; showGlobal = NO; @@ -326,13 +327,16 @@ - (void)switchGameMode:(id)sender { + [localHighscores release]; + if ([(UISegmentedControl*)sender selectedSegmentIndex] == 0) { - localHighscores = [Highscore localHighscoreListForGameMode:@"Collect"]; + localHighscores = [[Highscore localHighscoreListForGameMode:@"Collect"] retain]; } else { - localHighscores = [Highscore localHighscoreListForGameMode:@"Jump"]; + localHighscores = [[Highscore localHighscoreListForGameMode:@"Jump"] retain]; } + [globalHighscores release]; globalHighscores = nil; [self switchLists:areaControl]; -- cgit 1.4.1