We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1360

Summary: fluidsynth backend segfaults sdl-mixer
Product: SDL_mixer Reporter: Rafał Mużyło <galtgendo>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86   
OS: Linux   
Attachments: a diff with the change

Description Rafał Mużyło 2012-01-03 14:14:05 UTC
Created attachment 761 [details]
a diff with the change

First, a usual rant:
I tend to dislike registering to a forum/bugzilla/etc. for a sake of a single bug.
Also, "CC me on replies" wasn't in the mail by mistake.
/rant

Now, lets get on topic.

As I said in my mail, I've pulled a long list of fixes from the mercurial, up to http://hg.libsdl.org/SDL_mixer/rev/675a11e697c6 (I've skipped a few that were not needed by me (and plain ignored the next commit - call me a purist, but...)).
While I was mostly interested in modplug backed, I've decided to test fluidsynth backend too.

I've used playmus in the tests.
Upon setting SDL_SOUNDFONTS, playmus segfaulted.
A bit of testing and debugging led to following conclusion:
> adding 'Mix_InitFluidSynth();' in fluidsynth_loadsong_common at the
> start of 'if (SDL_BuildAudioCVT...' block fixes the crash
cause the crash was due to fluidsynth.new_fluid_settings==NULL at this point.
It seems that 
if ( fluidsynth.loaded == 0 ) Mix_InitFluidSynth();
at that point might even be a proper fix for this bug.

I'm unsure (as I haven't tested it), but it may matter that I've configured with '--disable-music-fluidsynth-shared', so the lib gets linked, instead of being dlopen.

I hope that the planned release will happen soon, it's been quite awhile since the last one.
Comment 1 Sam Lantinga 2012-01-03 22:43:37 UTC
/agreerant
Sorry, I missed the section of your e-mail where you asked to be CC'd.  I try to honor that, since I know it's a pain to join a mailing list or create accounts just to submit a bug.

Anyway, nice catch, thanks!
I commited a fix here:
http://hg.libsdl.org/SDL_mixer/rev/32e5ed415a34

You may want to get the other fixes I've done this year, since there are some good ones in there.

Cheers!