Allow unloading all plugins

This commit is contained in:
James Booth
2017-02-05 18:54:33 +00:00
parent b768c8b5c5
commit a9fab9ed2d
5 changed files with 168 additions and 114 deletions

View File

@@ -190,6 +190,27 @@ plugins_load(const char *const name)
}
}
void
plugins_unload_all(void)
{
GList *plugin_names = g_hash_table_get_keys(plugins);
GList *plugin_names_dup = NULL;
GList *curr = plugin_names;
while (curr) {
plugin_names_dup = g_list_append(plugin_names_dup, strdup(curr->data));
curr = g_list_next(curr);
}
g_list_free(plugin_names);
curr = plugin_names_dup;
while (curr) {
plugins_unload(curr->data);
curr = g_list_next(curr);
}
g_list_free_full(plugin_names_dup, free);
}
gboolean
plugins_unload(const char *const name)
{