From 00a480f77d934cf0105baaf817d36e465367f1b9 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 1 Feb 2014 02:27:31 -0700 Subject: [PATCH] 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. --- libobs/obs-module.c | 12 ++++++------ libobs/obs-ui.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libobs/obs-module.c b/libobs/obs-module.c index 144aea755..6d43b4504 100644 --- a/libobs/obs-module.c +++ b/libobs/obs-module.c @@ -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) { diff --git a/libobs/obs-ui.h b/libobs/obs-ui.h index e820e44f7..8cdb60ae5 100644 --- a/libobs/obs-ui.h +++ b/libobs/obs-ui.h @@ -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