# HG changeset patch # User Etan Reisner # Date 1137913590 0 # Node ID de3a3669dbe19feabd2c9d16eafbad0e4d4065a8 # Parent d1e6890ed062c6f07cfbbfc1badeea3b205d4d95 [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 diff -r d1e6890ed062 -r de3a3669dbe1 src/plugin.c --- 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))