changeset 18626:f05360b5470d

Fix core plugin dependency registering for gtkbuddynote to happen in plugin_init() so that it can work correctly. Add an additional sanity check in the core plugin unloading so that messed up dependency registrations don't cause crashes in the future. Thanks to deryni for helping figure this out.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 24 Jul 2007 03:52:21 +0000
parents 672dd03f538a
children 9eb399e7cacd 4167e2d7ebef
files libpurple/plugin.c pidgin/plugins/gtkbuddynote.c
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugin.c	Mon Jul 23 23:56:01 2007 +0000
+++ b/libpurple/plugin.c	Tue Jul 24 03:52:21 2007 +0000
@@ -692,7 +692,10 @@
 
 		dependency = purple_plugins_find_with_id(dep_name);
 
-		dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id);
+		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) {
--- a/pidgin/plugins/gtkbuddynote.c	Mon Jul 23 23:56:01 2007 +0000
+++ b/pidgin/plugins/gtkbuddynote.c	Tue Jul 24 03:52:21 2007 +0000
@@ -107,8 +107,6 @@
 
 		bninfo->flags = PURPLE_PLUGIN_FLAG_INVISIBLE;
 
-		info.dependencies = g_list_append(info.dependencies,
-		                                  "core-plugin_pack-buddynote");
 
 		/* If non-gtk buddy note plugin is loaded, but we are not, then load
 		 * ourselves, otherwise people upgrading from pre-gtkbuddynote days
@@ -134,6 +132,9 @@
 	/* Use g_idle_add so that the rest of the plugins can get loaded
 	 * before we do our check. */
 	g_idle_add(check_for_buddynote, plugin);
+
+	info.dependencies = g_list_append(info.dependencies,
+	                                  "core-plugin_pack-buddynote");
 }
 
 PURPLE_INIT_PLUGIN(gtkbuddynote, init_plugin, info)