diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h index 853cf85a9923..30f1f17137f8 100644 --- a/include/vlc_configuration.h +++ b/include/vlc_configuration.h @@ -88,6 +88,7 @@ struct module_config_t } list; const char **list_text; /* Friendly names for list values */ const char *list_cb_name; + void *owner; }; /***************************************************************************** diff --git a/src/config/core.c b/src/config/core.c index f1fc5161043c..5b9d7ac28d27 100644 --- a/src/config/core.c +++ b/src/config/core.c @@ -355,6 +355,12 @@ ssize_t config_GetIntChoices (vlc_object_t *obj, const char *name, size_t count = cfg->list_count; if (count == 0) { + if (module_Map(obj, cfg->owner)) + { + errno = EIO; + return -1; + } + if (cfg->list.i_cb == NULL) return 0; return cfg->list.i_cb(obj, name, values, texts); @@ -465,6 +471,12 @@ ssize_t config_GetPszChoices (vlc_object_t *obj, const char *name, size_t count = cfg->list_count; if (count == 0) { + if (module_Map(obj, cfg->owner)) + { + errno = EIO; + return -1; + } + if (cfg->list.psz_cb == NULL) return 0; return cfg->list.psz_cb(obj, name, values, texts); diff --git a/src/modules/bank.c b/src/modules/bank.c index a4998f62317b..c8d913cffb51 100644 --- a/src/modules/bank.c +++ b/src/modules/bank.c @@ -201,25 +201,6 @@ static int AllocatePluginFile (module_bank_t *bank, const char *abspath, if (plugin == NULL) return -1; - module_t *module = plugin->module; - assert(module != NULL); - - /* For now we force loading if the module's config contains callbacks. - * Could be optimized by adding an API call.*/ - for (size_t i = 0; i < plugin->conf.size; i++) - if (!atomic_load_explicit(&plugin->loaded, memory_order_relaxed) - && plugin->conf.items[i].list_cb_name != NULL) - { - /* !unloadable not allowed for plugins with callbacks */ - vlc_plugin_destroy(plugin); - - assert(bank->mode != CACHE_RESET); - plugin = module_InitDynamic(bank->obj, abspath, false); - if (unlikely(plugin == NULL)) - return -1; - break; - } - module_StoreBank(plugin); if (bank->mode != CACHE_IGNORE) /* Add entry to bank */ diff --git a/src/modules/cache.c b/src/modules/cache.c index cdeb715d8297..e727fa247c51 100644 --- a/src/modules/cache.c +++ b/src/modules/cache.c @@ -280,6 +280,7 @@ static int vlc_cache_load_plugin_config(vlc_plugin_t *plugin, block_t *file) if (item->i_type == CONFIG_ITEM_BOOL) plugin->conf.booleans++; } + item->owner = plugin; } return 0; diff --git a/src/modules/entry.c b/src/modules/entry.c index f9d6d8c2dec7..350fa66e51ca 100644 --- a/src/modules/entry.c +++ b/src/modules/entry.c @@ -142,17 +142,20 @@ static module_config_t *vlc_config_create(vlc_plugin_t *plugin, int type) } memset (tab + confsize, 0, sizeof (tab[confsize])); + tab += confsize; + tab->owner = plugin; + if (IsConfigIntegerType (type)) { - tab[confsize].max.i = INT64_MAX; - tab[confsize].min.i = INT64_MIN; + tab->max.i = INT64_MAX; + tab->min.i = INT64_MIN; } else if( IsConfigFloatType (type)) { - tab[confsize].max.f = FLT_MAX; - tab[confsize].min.f = FLT_MIN; + tab->max.f = FLT_MAX; + tab->min.f = FLT_MIN; } - tab[confsize].i_type = type; + tab->i_type = type; if (CONFIG_ITEM(type)) { @@ -160,9 +163,9 @@ static module_config_t *vlc_config_create(vlc_plugin_t *plugin, int type) if (type == CONFIG_ITEM_BOOL) plugin->conf.booleans++; } - plugin->conf.size++; - return tab + confsize; + + return tab; } /**