libobs: Free module if obs_module_load callback returns false
Currently if a module fails its load callback, it remains loaded and OBS continues to call additional exports such as obs_module_post_load. This goes against the documented behavior, which states that a module that fails its load callback is unloaded. This commit releases locale resources and frees the module's information, preventing further callbacks from libobs. The module itself (the DLL) is not yet unloaded from memory as os_dlclose is commented out for causing unspecified issues - this should be revisited in the future.
This commit is contained in:
parent
eb7d6e84aa
commit
4cc419e3c9
@ -291,7 +291,8 @@ static void load_all_callback(void *param, const struct obs_module_info *info)
|
||||
return;
|
||||
}
|
||||
|
||||
obs_init_module(module);
|
||||
if (!obs_init_module(module))
|
||||
free_module(module);
|
||||
|
||||
UNUSED_PARAMETER(param);
|
||||
}
|
||||
@ -499,6 +500,16 @@ void free_module(struct obs_module *mod)
|
||||
/* os_dlclose(mod->module); */
|
||||
}
|
||||
|
||||
for (obs_module_t *m = obs->first_module; !!m; m = m->next) {
|
||||
if (m->next == mod) {
|
||||
m->next = mod->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (obs->first_module == mod)
|
||||
obs->first_module = mod->next;
|
||||
|
||||
bfree(mod->mod_name);
|
||||
bfree(mod->bin_path);
|
||||
bfree(mod->data_path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user