[1.2 master] Crash after closing and reopening Mix_OpenAudio
SupSuper opened this issue · comments
(yes yes I know it's deprecated)
Simple test case:
int main()
{
SDL_Init(SDL_INIT_EVERYTHING);
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 2048);
Mix_CloseAudio();
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 2048);
}
This will crash on the second Mix_OpenAudio call with an access violation on the following line:
This issue only occurs on the "master" version of SDL_mixer 1.2 (b762825), not the last official release 1.2.12. Normally I would close it there, but we've had sporadic reports of Linux users running into this crash, so I can only assume they're building it from source or some distros are patching it.
(if reopening Mixer isn't supported, I'd also accept a workaround)
I can't reproduce this on linux at the moment.
I added this debug print:
diff --git a/dynamic_mod.c b/dynamic_mod.c
index e184ee7..a5a4388 100644
--- a/dynamic_mod.c
+++ b/dynamic_mod.c
@@ -219,6 +219,7 @@ int Mix_InitMOD(void)
SDL_UnloadObject(mikmod.handle);
return -1;
}
+/**/ fprintf(stderr,"MUSIC_MOD: loaded\n");
}
++mikmod.loaded;
.. and upon running your test case, MUSIC_MOD: loaded
printed on my terminal only once, meaning libmikmod is never unlodaded. valgrind doesn't any errors or warnings either...