[Quake2world-dev] r476 - quake2world/trunk/src

jdolan at jdolan.dyndns.org jdolan at jdolan.dyndns.org
Sat May 2 14:52:20 UTC 2009


Author: jdolan
Date: 2009-05-02 14:52:20 +0000 (Sat, 02 May 2009)
New Revision: 476

Modified:
   quake2world/trunk/src/s_music.c
   quake2world/trunk/src/sound.h
Log:
Fix crash on s_restart.  Apparently SDL_Mixer frees stuff that it doesn't allocate.  Cool.

Modified: quake2world/trunk/src/s_music.c
===================================================================
--- quake2world/trunk/src/s_music.c	2009-05-02 14:45:36 UTC (rev 475)
+++ quake2world/trunk/src/s_music.c	2009-05-02 14:52:20 UTC (rev 476)
@@ -63,13 +63,12 @@
 		if(!(music.music = Mix_LoadMUS_RW(rw))){
 			Com_Warn("S_LoadMusic: %s.\n", Mix_GetError());
 
-			Fs_FreeFile(buf);
-
 			SDL_FreeRW(rw);
+
+			Fs_FreeFile(buf);
 			continue;
 		}
 
-		music.rw = rw;
 		music.buffer = buf;
 
 		return &music;
@@ -91,9 +90,6 @@
 	if(music->music)
 		Mix_FreeMusic(music->music);
 
-	if(music->rw)
-		SDL_FreeRW(music->rw);
-
 	if(music->buffer)
 		Fs_FreeFile(music->buffer);
 }

Modified: quake2world/trunk/src/sound.h
===================================================================
--- quake2world/trunk/src/sound.h	2009-05-02 14:45:36 UTC (rev 475)
+++ quake2world/trunk/src/sound.h	2009-05-02 14:52:20 UTC (rev 476)
@@ -44,8 +44,7 @@
 typedef struct s_music_s {
 	char name[MAX_QPATH];
 	Mix_Music *music;
-	SDL_RWops *rw;  // this stays resident while the music is active
-	void *buffer;  // as does this
+	void *buffer;  // remains resident while the music is active
 } s_music_t;
 
 // the sound environment



More information about the Quake2World-dev mailing list