mod: always initialize libmikmod
The "mod" decoder plugin was being initialized lazily, but was deinitialized unconditionally. That led to segmentation faults. Convert mod_initMikMod() to be the global module initialization method. The MPD core should care about lazy initialization.
This commit is contained in:
parent
79d70f124d
commit
bb15c3bd45
@ -181,9 +181,6 @@ mod_decode(struct decoder *decoder, const char *path)
|
|||||||
float secPerByte;
|
float secPerByte;
|
||||||
enum decoder_command cmd = DECODE_COMMAND_NONE;
|
enum decoder_command cmd = DECODE_COMMAND_NONE;
|
||||||
|
|
||||||
if (!mod_initMikMod())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!(data = mod_open(path))) {
|
if (!(data = mod_open(path))) {
|
||||||
ERROR("failed to open mod: %s\n", path);
|
ERROR("failed to open mod: %s\n", path);
|
||||||
MikMod_Exit();
|
MikMod_Exit();
|
||||||
@ -222,11 +219,6 @@ static struct tag *modTagDup(const char *file)
|
|||||||
MODULE *moduleHandle;
|
MODULE *moduleHandle;
|
||||||
char *title;
|
char *title;
|
||||||
|
|
||||||
if (!mod_initMikMod()) {
|
|
||||||
DEBUG("modTagDup: Failed to initialize MikMod\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
path2 = g_strdup(file);
|
path2 = g_strdup(file);
|
||||||
moduleHandle = Player_Load(path2, 128, 0);
|
moduleHandle = Player_Load(path2, 128, 0);
|
||||||
g_free(path2);
|
g_free(path2);
|
||||||
@ -275,6 +267,7 @@ static const char *const modSuffixes[] = {
|
|||||||
|
|
||||||
const struct decoder_plugin modPlugin = {
|
const struct decoder_plugin modPlugin = {
|
||||||
.name = "mod",
|
.name = "mod",
|
||||||
|
.init = mod_initMikMod,
|
||||||
.finish = mod_finishMikMod,
|
.finish = mod_finishMikMod,
|
||||||
.file_decode = mod_decode,
|
.file_decode = mod_decode,
|
||||||
.tag_dup = modTagDup,
|
.tag_dup = modTagDup,
|
||||||
|
Loading…
Reference in New Issue
Block a user