changeset 21193:67940cc52dc4

Re-add a loop I removed in b5acf346a6ed692acc613d71a9ebbfcf4726cc63. It's necessary to update the dependent_plugins of each dependency of a plugin being unloaded. Without this, unloading the dependency later will result in a crash.
author Richard Laager <rlaager@wiktel.com>
date Sun, 07 Oct 2007 14:25:17 +0000
parents 5d93e197ba44
children a4a55a096ac8
files libpurple/plugin.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugin.c	Sat Oct 06 23:07:45 2007 +0000
+++ b/libpurple/plugin.c	Sun Oct 07 14:25:17 2007 +0000
@@ -676,6 +676,20 @@
 		}
 	}
 
+	/* Remove this plugin from each dependency's dependent_plugins list. */
+	for (l = plugin->info->dependencies; l != NULL; l = l->next)
+	{
+		const char *dep_name = (const char *)l->data;
+		PurplePlugin *dependency;
+
+		dependency = purple_plugins_find_with_id(dep_name);
+
+		if (dependency != NULL)
+			dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id);
+		else
+			purple_debug_error("plugins", "Unable to remove from dependency list for %s\n", dep_name);
+	}
+
 	if (plugin->native_plugin) {
 		if (plugin->info->unload != NULL)
 			if (!plugin->info->unload(plugin))