Don't rely on static data
The ui_enum function gets a const struct obs_ui_info **, which basically means it expects static data to be used. I originally had it the other way around, but yea, it's probably not a good idea, so I'm going to revert back to the original code instead, which doesn't rely on the data being static.
This commit is contained in:
parent
8bb208a090
commit
00a480f77d
@ -78,8 +78,8 @@ complete:
|
||||
|
||||
static void module_load_ui_exports(struct obs_module *mod)
|
||||
{
|
||||
bool (*enum_func)(size_t idx, const struct obs_ui_info **info);
|
||||
const struct obs_ui_info *ui_info;
|
||||
bool (*enum_func)(size_t idx, struct obs_ui_info *info);
|
||||
struct obs_ui_info ui_info;
|
||||
size_t i = 0;
|
||||
|
||||
enum_func = os_dlsym(mod->module, "enum_ui");
|
||||
@ -90,13 +90,13 @@ static void module_load_ui_exports(struct obs_module *mod)
|
||||
struct ui_callback callback;
|
||||
struct dstr name;
|
||||
|
||||
dstr_init_copy(&name, ui_info->name);
|
||||
dstr_init_copy(&name, ui_info.name);
|
||||
dstr_cat(&name, "_");
|
||||
dstr_cat(&name, ui_info->task);
|
||||
dstr_cat(&name, ui_info.task);
|
||||
dstr_cat(&name, "_");
|
||||
dstr_cat(&name, ui_info->target);
|
||||
dstr_cat(&name, ui_info.target);
|
||||
|
||||
callback.ui_info = *ui_info;
|
||||
callback.ui_info = ui_info;
|
||||
callback.callback = os_dlsym(mod->module, name.array);
|
||||
|
||||
if (!callback.callback) {
|
||||
|
@ -67,7 +67,7 @@ struct obs_ui_info {
|
||||
* ===========================================
|
||||
* Primary Exports
|
||||
* ===========================================
|
||||
* bool enum_ui(size_t idx, const struct obs_ui_info **ui_info);
|
||||
* bool enum_ui(size_t idx, struct obs_ui_info *ui_info);
|
||||
*
|
||||
* idx: index of the enumeration
|
||||
* ui_info: pointer to the ui data for this enumeration
|
||||
|
Loading…
x
Reference in New Issue
Block a user