]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
moved S_FreeSfx call in S_StopChannel to be in a safer place
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Jan 2012 22:36:33 +0000 (22:36 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 31 Jan 2012 22:36:33 +0000 (22:36 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11665 d7cf8633-e32d-0410-b094-e92efae38249

snd_main.c

index 614b16879dcb0dffc8578f0f4a09b19a4eec7dd8..1fb7cd54d8e7433d84c8645feba33dcdbeb99664 100644 (file)
@@ -1765,17 +1765,17 @@ void S_StopChannel (unsigned int channel_ind, qboolean lockmutex, qboolean frees
        
        ch = &channels[channel_ind];
        sfx = ch->sfx;
-       if (ch->sfx != NULL)
+       if (sfx != NULL)
        {
                if (sfx->fetcher != NULL && sfx->fetcher->stopchannel != NULL)
                        sfx->fetcher->stopchannel(ch);
                ch->fetcher_data = NULL;
                ch->sfx = NULL;
+               if (freesfx)
+                       S_FreeSfx(sfx, true);
        }
        if (lockmutex && !simsound)
                SndSys_UnlockRenderBuffer();
-       if (freesfx)
-               S_FreeSfx(sfx, true);
 }