project_files/HedgewarsMobile/Classes/VoicesViewController.m
changeset 3971 5c82ee165ed5
parent 3883 5934ddf9ed5d
child 4976 088d40d8aba2
--- a/project_files/HedgewarsMobile/Classes/VoicesViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -147,12 +147,17 @@
         Mix_FreeChunk(voiceBeingPlayed);
         voiceBeingPlayed = NULL;
     }
+    self.lastIndexPath = nil;
     MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
-    voiceBeingPlayed = NULL;
+    if (voiceBeingPlayed != NULL) {
+        Mix_HaltChannel(lastChannel);
+        Mix_FreeChunk(voiceBeingPlayed);
+        voiceBeingPlayed = NULL;
+    }
     self.lastIndexPath = nil;
     self.teamDictionary = nil;
     self.voiceArray = nil;