changeset 12985:de3a3669dbe1

[gaim-migrate @ 15338] Fix a looping oddness I was seeing, it didn't seem to hurt anything that I saw, but it certainly wasn't right. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Sun, 22 Jan 2006 07:06:30 +0000
parents d1e6890ed062
children 4e9935a539db
files src/plugin.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugin.c	Sun Jan 22 05:17:38 2006 +0000
+++ b/src/plugin.c	Sun Jan 22 07:06:30 2006 +0000
@@ -607,8 +607,8 @@
 gaim_plugin_unload(GaimPlugin *plugin)
 {
 #ifdef GAIM_PLUGINS
-	GList *l;
-	
+	GList *l, *l_next;
+
 	g_return_val_if_fail(plugin != NULL, FALSE);
 
 	loaded_plugins = g_list_remove(loaded_plugins, plugin);
@@ -626,11 +626,17 @@
 	plugin->loaded = FALSE;
 
 	/* Unload all plugins that depend on this plugin. */
-	for (l = plugin->dependent_plugins; l != NULL; l = l->next)
+	/* XXX Does this want to be while (plugin->dependent_plugins != NULL)
+	 * instead of this loop? I fixed it to get l->next before calling
+	 * gaim_plugin_unload (which can change the list here). This worked
+	 * much better for me but I'm not 100% sure it will always work. */
+	for (l = plugin->dependent_plugins; l != NULL; l = l_next)
 	{
 		const char * dep_name = (const char *)l->data;
 		GaimPlugin *dep_plugin;
 
+		l_next = l->next;
+
 		dep_plugin = gaim_plugins_find_with_id(dep_name);
 
 		if (dep_plugin != NULL && gaim_plugin_is_loaded(dep_plugin))