From: divverent Date: Sun, 9 Sep 2007 08:15:29 +0000 (+0000) Subject: For now, ground snd_restart and snd_unloadallsounds if the client is still connected... X-Git-Tag: xonotic-v0.1.0preview~2912 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=007638686ae47cba7696a37758ef92374afd09a4;p=xonotic%2Fdarkplaces.git For now, ground snd_restart and snd_unloadallsounds if the client is still connected, because DP keeps references to the sfx_t * that are being freed in the precache list. A real fix however would be ditching snd_unloadallsounds completely, and making a snd_reload command that unloads the sounds that are not being used at the moment, and reloads the sounds that are referenced. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7563 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/snd_main.c b/snd_main.c index 93decebf..ea880aaa 100644 --- a/snd_main.c +++ b/snd_main.c @@ -688,6 +688,14 @@ void S_Shutdown(void) void S_Restart_f(void) { + // NOTE: we can't free all sounds if we are running a map (this frees sfx_t that are still referenced by precaches) + // So, refuse to do this if we are connected. + if(cls.state == ca_connected) + { + Con_Printf("snd_restart would wreak havoc if you do that while connected!\n"); + return; + } + S_Shutdown(); S_Startup(); } @@ -783,6 +791,14 @@ void S_UnloadAllSounds_f (void) { int i; + // NOTE: we can't free all sounds if we are running a map (this frees sfx_t that are still referenced by precaches) + // So, refuse to do this if we are connected. + if(cls.state == ca_connected) + { + Con_Printf("snd_unloadallsounds would wreak havoc if you do that while connected!\n"); + return; + } + // stop any active sounds S_StopAllSounds();