fluid-fun: Don't dlclose libfluidsynth, ever

Some versions of the library do nasty things with thread
local storage without cleaning up after themselves.
This commit is contained in:
Jonas Kulla 2014-10-20 10:17:48 +02:00
parent 1c1d72b03e
commit 6145c59305
3 changed files with 4 additions and 11 deletions

View File

@ -61,13 +61,7 @@ fail:
Debug() << "Failed to load " FLUID_LIB ". Midi playback is disabled."; Debug() << "Failed to load " FLUID_LIB ". Midi playback is disabled.";
memset(&fluid, 0, sizeof(fluid)); memset(&fluid, 0, sizeof(fluid));
finiFluidFunctions();
#endif
}
void finiFluidFunctions()
{
#ifndef SHARED_FLUID
SDL_UnloadObject(so); SDL_UnloadObject(so);
so = 0;
#endif #endif
} }

View File

@ -55,6 +55,5 @@ struct FluidFunctions
extern FluidFunctions fluid; extern FluidFunctions fluid;
void initFluidFunctions(); void initFluidFunctions();
void finiFluidFunctions();
#endif // FLUIDFUN_H #endif // FLUIDFUN_H

View File

@ -53,7 +53,9 @@ struct SharedMidiState
~SharedMidiState() ~SharedMidiState()
{ {
if (!HAVE_FLUID || !inited) /* We might have initialized, but if the consecutive libfluidsynth
* load failed, no resources will have been allocated */
if (!inited || !HAVE_FLUID)
return; return;
fluid.delete_settings(flSettings); fluid.delete_settings(flSettings);
@ -63,8 +65,6 @@ struct SharedMidiState
assert(!synths[i].inUse); assert(!synths[i].inUse);
fluid.delete_synth(synths[i].synth); fluid.delete_synth(synths[i].synth);
} }
finiFluidFunctions();
} }
void initIfNeeded(const Config &conf) void initIfNeeded(const Config &conf)