mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix the crashing bug hopefully
A value of 1 in freesrc for Mix_LoadWAV_RW and Mix_LoadMus_RW calls SDL_RWclose on the RWops anyway. For Mix_LoadWAV_RW the RWops is freed right after the data is loaded (because it makes a copy of the data in memory) For Mix_LoadMUS_RW the RWops is freed when Mix_FreeMusic is called (because the data is not a copy) So setting 1 on freesrc doesn't actually free the RWops immediately on Mix_LoadMus_RW *unless* it failed to load any music.
This commit is contained in:
parent
00c36a9d9e
commit
d9d98ec1a9
1 changed files with 2 additions and 5 deletions
|
|
@ -392,7 +392,6 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
if (rw != NULL)
|
||||
{
|
||||
chunk = Mix_LoadWAV_RW(rw, 1);
|
||||
SDL_RWclose(rw);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
|
|
@ -663,8 +662,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
|
|||
rw = SDL_RWFromMem(data, len);
|
||||
if (rw != NULL)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(rw, SDL_FALSE);
|
||||
SDL_RWclose(rw);
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
}
|
||||
if (!music)
|
||||
{
|
||||
|
|
@ -831,8 +829,7 @@ INT32 I_RegisterSong(void *data, size_t len)
|
|||
SDL_RWops *rw = SDL_RWFromMem(data, len);
|
||||
if (rw != NULL)
|
||||
{
|
||||
music = Mix_LoadMUS_RW(rw, SDL_FALSE);
|
||||
SDL_RWclose(rw);
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
}
|
||||
if (!music)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue