Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.2 master] Crash after closing and reopening Mix_OpenAudio #580

Open
SupSuper opened this issue Dec 18, 2023 · 1 comment
Open

[1.2 master] Crash after closing and reopening Mix_OpenAudio #580

SupSuper opened this issue Dec 18, 2023 · 1 comment

Comments

@SupSuper
Copy link

(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:
image

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)

@sezero
Copy link
Contributor

sezero commented Dec 18, 2023

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants